You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jarlin Almanzar edited this page Nov 21, 2019
·
3 revisions
User Input and While Loops
Input()
The function pauses your program and waits for the user to enter some text. Once it retrieves the input, it assigns it to a variable.
Python interprets Input values as a string
height=input("How tall are you, in inches: ")
height=int(height)
ifheight>48:
print("You are tall enough")
else:
print("\n You'll be able to ride when you're a little older.")
While Loop
A loop that runs as long as the condition is true.
prompt="Tell me something, and I will repeat it back to you."prompt+="\n Enter 'quit' to end the program."msg=""whilemsg!='quit':
msg=input(prompt)
print(msg)