Home > Net >  I am getting an error message whenever I try and run this
I am getting an error message whenever I try and run this

Time:12-28

score = input("what you score bro: ")
if score > 1000:
  print("winner")
else:
  print("loser")

(I am a complete noob). Idk why im getting an error looks right to me.

I tried it on my own then I watched the video again and looked at the bald guys code and mine looks the same idk whats wrong

CodePudding user response:

It's not a well-formulated question, but that doesn't mean newcomers shouldn't be helped out. Python relies on proper spacing.

If that's not your issue, you need to know that python will take input as a string, so you need to cast it explicitly to an integer

The following will work. Note the spacing and the explicit cast to an integer type:

score = input("what you score bro: ")
score = int(score)
if score > 1000:
    print("winner")
else:
    print("retard")
  • Related