The input () function allows you to accept typed input from a user as a string....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The input () function allows you to accept typed input from a user as a string. For example, X = input ("Please input a number. ") # user types 7 X # output '7' Write code that prompts a user to input an odd int. If the user inputs an even int, the code should re-prompt them for an odd integer. After the user has entered an odd integer, the code should print a list of all numbers that the user input. The code int("1") will convert strings composed of numerals into integers. You may assume that the user will only input such strings. Hint: Try while and associated tools. Example #your code > Please enter an integer. 6 > Please enter an integer. 8 > Please enter an integer. 4 > Please enter an integer. 9 > [6, 8, 4, 9] The input () function allows you to accept typed input from a user as a string. For example, X = input ("Please input a number. ") # user types 7 X # output '7' Write code that prompts a user to input an odd int. If the user inputs an even int, the code should re-prompt them for an odd integer. After the user has entered an odd integer, the code should print a list of all numbers that the user input. The code int("1") will convert strings composed of numerals into integers. You may assume that the user will only input such strings. Hint: Try while and associated tools. Example #your code > Please enter an integer. 6 > Please enter an integer. 8 > Please enter an integer. 4 > Please enter an integer. 9 > [6, 8, 4, 9]
Expert Answer:
Answer rating: 100% (QA)
Python numbers while True userinput inputPlease enter an integer try number intuserinput if ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Assume the following information: Mexican one-year interest rate = 9% U.S. one-year interest rate = 3% Peso spot rate = 0.12 $/p Peso forward rate = 0.06 $/p If interest rate parity exists, how much...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Write a static method max3() that takes three int arguments and returns the value of the largest one. Add an overloaded function that does the same thing with three double values.
-
Find Vo(t),t>0 in the network. Describe.
-
In 2016, Sondra Corporation recognizes $18,000 in Section 1231 gains and $10,000 in Section 1231 losses. In 2011, Sondra reported $12,000 in Section 1231 losses and no Section 1231 gains. No other...
-
Air enters a frictionless, constant area duct with \(\mathrm{Ma}=2.5\), \(T_{0}=20^{\circ} \mathrm{C}\), and \(p_{0}=101 \mathrm{kPa}(\mathrm{abs})\). The gas is decelerated by heating until a normal...
-
Calculating the Total Overhead Variance Standish Company manufactures consumer products and provided the following information for the month of February: Units produced.....................131,000...
-
The plaintiff, WandaRer, is aCanadian and a self-described artist, photographer, and social media influencer. For almost a decade, Ms. Rer has traveled the world with her camera. Ms. Rer has her...
-
A rotary worktable is driven by a Geneva mechanism with five slots. The driver rotates at 48 rev/min. Determine (a) The cycle time, (b) Available process time, and (c) Indexing time each cycle.
-
Find g (-5), g (0), and g (5) g(x) 4 1 0 -1 -3 4 -51 -6 4 -2 0 2 4 g(-5) (Click to select) g(0) (Click to select) g(5) (Click to select) (Click to select) 0 -4 is underfined
-
The organisational consequences of work-life balance have become an important issue for organisations today. It is believed that balancing a successful career with a personal/family life can be...
-
Assignment2122_v1.docx - Word Arial 16 A A Aa A A IEEE A B I U ab F x x A A A D LAW Cheuk Yin (210165298) AaBbCc AaBbCcD AaBbCcl AaBbCc AaBb( AaBb AaBbC AaBbc AaBbCc AaBbCcl...
-
Pick one or two of your favorite topics you've learned about this semester. Prepare short video, graphics, designs, or PowerPoint that explains your favorite topic(s). Look for resources, other than...
-
When it comes to work-life balance, people all over the world are struggling with more and more work demands placed on them. The total amount of work hours in many developed nations has increased...
-
Work-life balance refers to the equilibrium individuals seek between their professional responsibilities and personal life. Achieving a healthy balance is crucial for overall well-being, as it...
-
32.The flow rate of water from a tap of diameter of 1.25 cm is 3 litres per minute. The coefficient of viscosity of the water is 10pa/s. Characterize the flow.
-
In Exercises discuss the continuity of each function. f(x) -3 1 x - 4 y 3 2 -1 -2 -3+ 3 X
-
Begin with the following structure declaration: struct chaff { char dross[20]; int slag; }; Write a program that uses placement new to place an array of two such structures in a buffer.Then assign...
-
For each of the following sets of classes, indicate whether public or private derivation is more appropriate for Column B: A class Bear class Kitchen class Person class Person. class Person, class...
-
Use a member function to overload the multiplication operator for the Stonewt class; have the operator multiply the data members by a type double value. Note that this will require carryover for the...
-
Enthalpy of superheated steam is given by (a) \(h_{g}+c_{p s} \ln \frac{\mathrm{T}_{\text {sup }}}{\mathrm{T}_{s}}\) (b) \(h_{f}+h_{f g}\) (c) \(s_{g}+x s_{f g}\) (d) \(x s_{f}\)
-
What do you understand by the term priming ?
-
Determine the change in internal energy when one \(\mathrm{kg}\) of steam expands from \(10 \mathrm{bar} 300^{\circ} \mathrm{C}\) to 0.5 bar and 0.9 dry. Take \(c_{p s}=2.1 \mathrm{~kJ} /...
Study smarter with the SolutionInn App