Python Forum
multiple inputs - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: multiple inputs (/thread-10419.html)



multiple inputs - newbee - May-20-2018

x=input("choose number: 1,2,3,4\n")
if (x=="1"):
    y=input("choose letter: a,b,c,d\n") 
    if (y=="a"):
        print "hello"
can some one tell me what i am doing wrong here ? Undecided


RE: multiple inputs - micseydel - May-20-2018

Please use code tags in the future. I've added them here for you this one time.

What makes you think there's something wrong? What's the input? What's the output? (Both expected and actual, including if it's an error.)


RE: multiple inputs - newbee - May-20-2018

i am a new here..sure, will do next time

i am using
execfile('test.py') to run this code

when i give first input as 1

it doesn't continue to the if condition


RE: multiple inputs - snippsat - May-20-2018

(May-20-2018, 12:55 AM)newbee Wrote: execfile('test.py') to run this code
Run code the normal way python test.py
There is nothing wrong with code.
E:\1py_div
λ python test.py
choose number: 1,2,3,4
1
choose letter: a,b,c,d
a
hello
Better style.
number = input("choose number: 1,2,3,4\n")
if number == '1':
    letter = input("choose letter: a,b,c,d\n")
    if  letter == "a":
        print("hello")
Use Python 3,installation Windows or Linux .