jeudi 2 janvier 2020

Simple if else statement in python is not working [duplicate]

This question already has an answer here:

Here is a very basic program that takes an input and prints "Number is 5" if the number is 5 and prints "Number not 5" if the number is not 5.

user = input("Enter a number: ")
if user == 5:
    print("Number is 5")
else:
    print("Number not 5")

This is a simple enough if statemnt but is not working and no matter what number i put, it prints "Number not 5". I am new to programming but i am quite used to using if statements now but this one is tripping me up. What am i doing wrong here. Thanks for helping.

Aucun commentaire:

Enregistrer un commentaire