Question: The input () function allows you to accept typed input from a user as a string. For example, X = input (Please input a
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]
Step by Step Solution
There are 3 Steps involved in it
Python numbers while True userinput inputPlease enter an integer try number intuserinput if ... View full answer
Get step-by-step solutions from verified subject matter experts
