+ 1

Appending User Input to List from Console

Hello, hello. I am a beginner in Python. I'm trying to add user input to a list from the console. The for loop I tried using is not running, but everything else works and there are no reported errors. Code below. # Scores quizzes/tests in which answers consist of numerical rating values (integers) for any range input by the user. # Declare list to store point values points = [] # Ask user for upper and lower range, number of questions. Lower_Range = input("Lowest possible score: ") Upper_Range = input("Highest possible score: ") Questions = input("How many questions? ") # Obtain highest possible score overall by multiplying upper range by the number of questions. highest_possible = Upper_Range * int(Questions) # Create 'for loop' to get score input from the user for each question. # Break after the last question. for point in points: question = + 1 print("Question " + str(question) + ": ") points.append(input("")) if question > int(Questions): break # Calculate percentage score percentage = sum(points) / int(highest_possible) round(percentage) print("Your score is " + str(percentage) + "%.")

10th Mar 2020, 7:40 PM
Ursula.
Ursula. - avatar
1 Odpowiedź
+ 1
Thank you!
10th Mar 2020, 9:12 PM
Ursula.
Ursula. - avatar