0
question = input("what is 8 + 13? ")
math = 8 + 13
if question == 21:
  print("that is correct")
if question != 21:
  print("That is wrong")

#when i put in 21 it prints that is wrong instead of correct, why. #I thought it was becuase it was comparing a int and a str but I dont know how to fix it.

1 Answers1

1

make sure you type cast. inputs are strings by default

question = int(input("what is 8 + 13? "))
math = 8 + 13
if question == 21:
  print("that is correct")
if question != 21:
  print("That is wrong")
smcrowley
  • 451
  • 3
  • 10