Aug-03-2019, 02:15 PM
i found an error in the 3rd selection changed to as follows:
Please look over and give any input as to what i can do if anything to make it cleaner, or any input
COMPLETED code
Traceback (most recent call last):
File "C:/Users/raymond/Documents/School/Python/week 4/week 4 program final copy.py", line 42, in <module>
score.sort()
TypeError: '<' not supported between instances of 'str' and 'float'
>>>
elif selection == "3": if len(score): scores = input("Please enter a score between 0 and 100: ") score.append(scores) print ('score added to list')Now i think my list program is complete I just need to add the statement to ensure an error is not generated if a <100 or>1 score is added.
Please look over and give any input as to what i can do if anything to make it cleaner, or any input
COMPLETED code
menu = """ 1: Enter to exit 2: List scores so far 3: Add a score 4: Display the highest and lowest scores """ score = [ 85.3, 85.2, 21.99 ] done = False finished = False while not done: print (menu) selection = input ("Please enter menu item 1-4: ") if selection == "1": done = True print("Thank you for using The score engine") elif selection == "2": print("Scores recorded so far:") print(*score, sep = "\n") elif selection == "3": if len(score): scores = input("Please enter a score between 0 and 100: ") score.append(scores) print(*score, sep = "\n") print ('score added to list') elif selection == "4": print("Score engine highest to lowest:") score.sort() print("Highest score:", max(score), "Lowest score:", min(score))while I was checking everything before posting selection 4 no longer works....ugh I guess something I did to selection 3 (maybe if command) below is error I get
Traceback (most recent call last):
File "C:/Users/raymond/Documents/School/Python/week 4/week 4 program final copy.py", line 42, in <module>
score.sort()
TypeError: '<' not supported between instances of 'str' and 'float'
>>>