I am working on a Paycheck calculator as a little side project for my portfolio and I have it so that users can input their own information (i.e. pay rate, hours worked, shift differentials, etc.) and parts of my code have inputs for variables:
payrate = float(input("What is your current payrate? $"))
When the code is run it asks the user to enter a value for their pay, but if they enter $20 instead of 20, I get:
ValueError: could not convert string to float: '$20'
How can I optimize my code so that it either ignores the $ when a user inputs something other than a float
or it gives a rejection message to the user that I can write out myself in plain English so they know what to do?
Thank you!
Github link in case anyone wants to check it out for themselves (warning: still a massive WIP... so be gentle)