samedi 27 octobre 2018

python user input for finding leap year not printing

I am trying to create a function that accepts a users input and tries to figure out whether the year is a leap year and later also accept the users day of year (i.e. 355) and turns it into which day of the year it is (and output December, 10 2018). But for now I am not sure why it will not output whether the year is True or False. I tried to use the int parameter to change the user input from a string to a number but I am not sure if that is where I went wrong.

 user_year = input('Enter year: ')
    val = int(user_year)
    def leap_year(val):
        if val % 400 == 0:
            print ("True")
        if val % 100 == 0:
            print ("False")
        if val % 4 == 0:
            print ("True")
        else:
            print ("False")

Aucun commentaire:

Enregistrer un commentaire