0

I'm not very experienced with python and I have been trying to make the program recognize that 1, 2, or 3 are each something different. But anything else other than those three numbers is irrelevant. Here is what I've tried:

This first one just compiles all three into 1 string so it will only recognize the string '123' instead of '1' or '2' or '3'.

var = input('What is your favorite number? (1-3)')
if var == '1'
  print('Hello World!')
if var == '2'
  print('Goodbye World')
if var == '3'
  print('Hmm')
if not var == '1' '2' '3':
    print('IDK that number')

And these next two say invalid syntax.

var = input('What is your favorite number? (1-3)')
if var == '1'
  print('Hello World!')
if var == '2'
  print('Goodbye World')
if var == '3'
  print('Hmm')
if not var == '1' == or '2' == or '3':
    print('IDK that number')
var = input('What is your favorite number? (1-3)')
if var == '1'
  print('Hello World!')
if var == '2'
  print('Goodbye World')
if var == '3'
  print('Hmm')
if not var == '1', '2', '3':
    print('IDK that number')

Idk if this has already been posted but I couldn't find anything close. Hope you can help!

Yeetsa Jr
  • 25
  • 5

0 Answers0