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 ?

multiple inputs
|
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 ? ![]()
May-20-2018, 12:24 AM
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.)
May-20-2018, 12:55 AM
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 (May-20-2018, 12:55 AM)newbee Wrote: execfile('test.py') to run this codeRun 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 helloBetter 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 . |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Multiple variable inputs when only one is called for | ChrisDall | 2 | 1,196 |
Oct-20-2023, 07:43 PM Last Post: deanhystad |
|
![]() |
Multiple inputs on the same line (beginner) | dementshuk | 9 | 4,556 |
Sep-03-2021, 02:21 PM Last Post: dementshuk |
Generate Multiple sql Files With csv inputs | vkomarag | 13 | 6,225 |
Aug-20-2021, 07:03 PM Last Post: vkomarag |
|
Help with applying this instrument monitoring code to multiple inputs. | Kid_Meier | 1 | 2,733 |
Mar-04-2020, 12:01 PM Last Post: Kid_Meier |
|
Problem with accepting multiple string inputs | Ryan_Todd | 5 | 3,948 |
Jan-22-2020, 06:12 PM Last Post: buran |
|
Watching for inputs from multiple sources concurrently | anakaine | 4 | 3,700 |
Mar-03-2019, 07:38 PM Last Post: woooee |