Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
Python
|
User input
User input
User input
input() function:
msg = input('Enter a message: ') print(msg)
Enter a message: Hello Hello
Use while loop with input() function:
msg = '' while msg != 'exit': msg = input('Enter a new message: ') if msg != 'exit': print(msg)
Enter a new message: Hello Hello Enter a new message: Python Python Enter a new message: exit
Use while loop with input() function:
while True: msg = input('Enter a new message: ') if msg == 'exit': break print(msg)
Enter a new message: Hello Hello Enter a new message: Python Python Enter a new message: exit
© 2010-2022
mti
tek