Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 1

Python numbers while True userinput inputPlease enter an integer try number intuserinput if ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions

Question

Graph one period of each function. y = 4 cos x

Answered: 1 week ago