Write an input validation loop which prevents the user from entering a number larger than 100...
Fantastic news! We've Found the answer you've been seeking!
Question:
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/65094a0370163_1695107585913.jpg)
Transcribed Image Text:
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 <0 or 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 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 <0 or 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
Expert Answer:
Answer rating: 100% (QA)
mainpy 1 Collect input and assign to jellybeans 2 jelly beans intinputH... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Why is the fact that a hospital operates an emergency room open to all persons regardless of ability to pay is a significant factor the IRS considers when determining if the hospital provides a...
-
There are many different types of business messages forms, and each has its own unique traits and purpose. Every business communication situation requires analysis to determine which type of message...
-
You are asked to develop a Floppy Disk program that allows users to access a floppy disk locally mounted on a computer. You are expected to use C programming language. In your program, all file I/O...
-
What effect does a weakening in U.S dollar have on Net Income for subsidiaries of U.S companies?
-
Is it necessary for property to provide a long-term benefit to its owners in order for the gain or loss on sale to be considered a capital gain or capital loss?
-
Find the formulas for the indicated perimeters and areas. Perimeter of Fig. 2.135 (a right triangle and semicircle attached) b 2a Fig. 2.135
-
What is the probability that none of the 55 people would rate their financial shape as good? (Make the assumption that the 500 people are represented by the pie chart.)
-
How might the business research industry take action to ensure that the public believes that telephone surveys and door-to-door interviews are legitimate activities and that firms that misrepresent...
-
1. Using the information presented below, prepare an income statement and statement of financial position from the adjusted trial balance of Hanson Storage. $ 3,050 400 830 80 4,200 $ 1,100 98,000...
-
You work at DeliWine, a US wine retailer. DeliWine sources one of their best selling wines, JeanRose, from a Dutch wine distributor. The cost of placing an order is $ 513 and the annual holding cost...
-
Sneskite made sales of $15000 to JD Sports. The inventory is worth $8000 JD Sports will pay it 45 days Select the flown and account that would be used to record the Inventory Please select a...
-
X Calculate the reaction rate at various conversions, as shown below: FAO -TA -TA 0.2 0.8 Considering that for a PFR: dx V = FAO What is the conversion reached after the 50 m of this PFR?
-
For decades, leaders have talked about flexible working options, yet only few companies were consistently using these practices prior to the global health crisis of 2020. In March 2020, organizations...
-
Manatee Corp. has developed standard costs based on a predicted operating level of 352,000 units of production, which is 80% of capacity. Variable overhead is $281,600 at this level of activity, or...
-
When leaders are facing a crisis or an opportunity, generally, they tend to fall back on the leadership style that has worked for them in the past. Discuss with examples the options that would help...
-
Data Table the pasteet dollar -X Total sales revenues 2 Number of units produced and sold 500,000 units Selling price nt. $ 230,000 te Operating Income Total Investment in assets Variable cost per...
-
The Shasti Corporation reported the following for the year ending December 31, 20X1: Service cost: $142,610 Plan assets, January 1, 20X1: $1,200,000 Prior service cost amortization: $21,150 Expected...
-
What is the difference between direct materials and indirect materials?
-
Given the unity feedback system of Figure P11.1 with do the following: a. Use frequency response methods to determine the value of gain, K, to yield a step response with a 20% overshoot. Make any...
-
Many systems are piecewise linear. That is, over a large range of variable values, the system can be described linearly. A system with amplifier saturation is one such example. Given the differential...
-
Sketch the root locus for the unity feedback system shown in Figure P8.3, where Give the values for all critical points of interest. Is the system ever unstable? If so, for what range of K? K(s +2)...
-
David Rose is puzzled. His company had a price-earnings ratio of 25 in 2004. He feels that this is an indication that the company is doing well. Julie Bast, his accountant, says that more information...
-
Which ratio or ratios from this chapter do you think should be of greatest interest to: (a) a pension fund considering investing in a corpo- ration's 20-year bonds? (b) a bank contemplating a...
-
Name ratios useful in assessing (a) li- quidity, (b) solvency, and (c) profitability. AppendixLO1
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App