Question: Write an input validation loop which prevents the user from entering a number larger than 100 or less than 0. Then, enter the appropriate

Write an input validation loop which prevents the user from entering a

 

Write an input validation loop which prevents the user from entering a number larger than 100 or less than 0. Then, enter the appropriate numbers when prompted so you match the output under Desired Output. Click Run to check your code. Click Submit to submit your code to your instructor Submit 1 # Collect input and assign to /jelly beans/ 2 jelly beans int(input("How many jelly beans do you want? ")) 3 Run 4 5 6 7 8 9 18 11 12 13 Redo Save # Write input validation loop #jelly beans/ must be greater than 81 # and less than 100 Your Output: Please enter a number between 0 and 100 -5 Please enter a number between 0 and 100 200 You want 75 jelly beans while(jelly beans -100): print("Please enter a number between 0 and 100",jelly_beans) jelly beans - int (input ("How many jelly beans do you want? ")) Desired Output: # Display final result. print("You want", jelly beans, "jelly beans") How many jelly beans do you want? -5 Please enter a number between 0 and 100 How many jelly beans do you want? 200 Please enter a number between 0 and 100 How many jelly beans do you want? 75 You want 75 jelly beans

Step by Step Solution

3.50 Rating (170 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

mainpy 1 Collect input and assign to jellybeans 2 jelly beans intinputH... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!