Python Forum
Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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 ? Undecided
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.)
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
i am a new here..sure, will do next time

i am using
execfile('') 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('') to run this code
Run code the normal way python
There is nothing wrong with code.
λ python
choose number: 1,2,3,4
choose letter: a,b,c,d
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":
Use Python 3,installation Windows or Linux .

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with applying this instrument monitoring code to multiple inputs. Kid_Meier 1 321 Mar-04-2020, 12:01 PM
Last Post: Kid_Meier
  Problem with accepting multiple string inputs Ryan_Todd 5 505 Jan-22-2020, 06:12 PM
Last Post: buran
  Watching for inputs from multiple sources concurrently anakaine 4 781 Mar-03-2019, 07:38 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020