0

Here is my code

inputUSer=input('''
    Please Select The Mode you want to operate The script AS:
    1:  You selected-1 \n
    2:  You selected-2 \n
    3:  You selected-3\n
    4:  You selected-4 \n
''')

if inputUSer==1:
    print("You selected-1")


elif inputUSer==2:
    print("You selected-2")

elif inputUSer== 3:
    print("You selected-3")

elif inputUSer== 4:
    print("You selected-4")

else :
    print("OOPS! Seems like you entered the wrong Input")

I checked all the indentation and it's correct. I am new to python and a Noob. Please Help me... Thank you...

Batman
  • 111
  • 1
  • 1
  • 11

3 Answers3

2

The result of input() is a str, it'll never be equal to 1,2,3,4 as their as ints, you need to convert input

inputUSer = int(input('''
    Please Select The Mode you want to operate The script AS:
    1:  You selected-1 \n
    2:  You selected-2 \n
    3:  You selected-3\n
    4:  You selected-4 \n
'''))

Or change all the if to compare to a str

if inputUSer == '1':
azro
  • 53,056
  • 7
  • 34
  • 70
1

Pass your input into an int()

inputUSer=int(input('''
    Please Select The Mode you want to operate The script AS:
    1:  You selected-1 \n
    2:  You selected-2 \n
    3:  You selected-3\n
    4:  You selected-4 \n
'''))
JayC
  • 21
  • 1
1

Return value of input is a string. You might want to cast it to an integer using int function. Or you can change your if conditions to compare inputUSer with strings instead.

Abhinav Goyal
  • 1,312
  • 7
  • 17