lundi 26 août 2019

Invalid Token and if statement not working

This is my first time programming in Python and I am not too sure what I am doing wrong. I am simply trying to print what the hour (time) is in words however I get the error "SyntaxError: invalid token" when I set the if statement to check

if current_hour == 05:

and when I change the 05 to 5 the If Statement simply does nothing.

This is my code:

import time

current_hour = time.strftime("%I")
print(current_hour)

if current_hour == 05:
    print("Five")

Thank you!

Aucun commentaire:

Enregistrer un commentaire