#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    1

    Lifetime Checker Script, Error Found !


    Hey Python Users...

    I try to create an script, to check your lifetime... with the datetime modulle...
    This is my script:

    Code:
    from datetime import datetime
    
    now = datetime.now()
    
    birtday = int(input("Your Birthday: "))
    lifetime = now.year - birthday
    
    
    print(lifetime)



    If i run this script, i get this error:
    Traceback (most recent call last):
    File "C:/Users/Gebruiker/Desktop/YearChacker.py", line 6, in <module>
    lifetime = [now.year - birthday]
    NameError: name 'birthday' is not defined
    Can enyone correct my code pleace... so i can expiriment with it ?...
    Thanks, Jamie.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    1
    Oh... can you correct my code for my lifetime checker in day/month/year... just so anyone can with my lifetime checker
    call his completely birthday, with his lifetime result... Just one code with only the lifetime year chacker and one with
    the completely lifetime checker in dd/mm/yyy... ?...

    Thank for help... give my two diffrence examples please, just i can expiriment with it,
    Greats Jamie.
  4. #3
  5. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,971
    Rep Power
    509
    birthday is misspelled. Or birtday is misspelled.

    birtday = int(input("Your Birthday: "))
    lifetime = now.year - birthday
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo