0
How do i check for input?
How do i make my program check for input? As in "if there is input: do something"
5 ответов
0
Hi, Unexpected Explosions !
If there is the possibility to use multiple inputs you looking for, and you don’t know the number of inputs from the beginning, you can take a look at this code:
https://code.sololearn.com/cbPe32KfwQhF/?ref=app
Just ask if you have any questions.
+ 6
Unexpected Explosions ,
just as Lisa mentioned:
name = input()
if name == "Tom":
do this...
elif name == "Ann":
do this...
elif name == "":
do this....
else:
do this....
instead of strings you can also handle numerical inputs.
+ 5
You can use the input() as described in lesson 16 of Python for Beginners. If the input is empty (""), you can use default values
+ 3
n = input()
if n:
print('There's an input')
0
Lisa, That's not exactly what i need. This lesson explains how to use the "input" function in general, not how to pair it with the "if" operator