0

I need my code to print something certain if a user-inputted integer variable is one of a few certain numbers:

a = int(input())
if a == 1, 3, 6, 9:  # <-- This line causes the error
  print("yes")

What is in there returns an error, how can I make it work?

smci
  • 32,567
  • 20
  • 113
  • 146
  • Are the `**` asterisks just you formatting for emphasis, or is that actual code (if so, it'll cause a syntax error). – smci Feb 04 '20 at 22:58
  • No, I just wanted to emphasize what needed to be fixed. Sorry, I can see why that would spark confusion. – goldleader1801 Feb 07 '20 at 19:12
  • No problem, code examples have to be able to run exactly as copy-pasted. Best practice is to do line-specific highlights via comments (or strings or docstrings) – smci Feb 07 '20 at 23:15
  • Also don't ever say you got "**an** error". Python should give you back a comprehensive and very useful traceback. – Jongware Feb 08 '20 at 00:10

0 Answers0