Nov-24-2017, 11:41 PM
I changed up my code to take away the extra while loop and include it in the first while statement when the user puts in a negative it works great. However, when they put in a string I receive a ValueError like below. I have a feeling it has to do with my is_actual_float function but I can't seem to figure out where. I tried changing things around but it didn't work.
Traceback (most recent call last): File "C:/Users/Eman/Desktop/lab5_2/lab5.py", line 82, in <module> main() File "C:/Users/Eman/Desktop/lab5_2/lab5.py", line 75, in main pints_collected = get_pints_for_drive() File "C:/Users/Eman/Desktop/lab5_2/lab5.py", line 24, in get_pints_for_drive pints = float(input("Enter pints collected: ")) ValueError: could not convert string to float: 'Im lost'Also, I tried your second recommendation with the max and min and for some reason, I keep getting an error message whether it be the format you gave me or the python shortcuts. I know your format is correct along with the python shortcuts. In short, I just need a quick explanation of what the following error message means. I've looked on the internet and just cannot find a concrete answer.
Traceback (most recent call last): File "C:/Users/Eman/Desktop/lab5_2/lab5.py", line 82, in <module> main() File "C:/Users/Eman/Desktop/lab5_2/lab5.py", line 77, in main maximum = max(pints_collected) TypeError: 'float' object is not iterable