here is a super simple (easy to understand) age counter, which ask for username input, birthday, and recent date. i'm adding some commentation function in the end of the code
'''program penghitung umur'''
#username input name = raw_input ("who are you?") #birth date from user input in number tbirth = input ("birthday date") bbirth = input ("birth month") dbirth = input ("birth year") birth = tbirth + (bbirth * 30) + (dbirth * 365)
#recent date trecent = input ("recent day") brecent = input ("recent month") drecent = input ("recent year") recent = trecent + (brecent * 30) + (drecent * 365)
#begin calculation process year = (recent - birth) / 365 month = ((recent - birth) % 365) / 30 day = ((recent - birth) % 365) % 30
#tampilkan hasil print "hallo", name, "your age is :", print day, "days", months, "months", year, "years"
'''commentation''' if year <= 5: print "you're still a baby" elif year <= 17: print "you're still a teenager" elif year <= 45: print "you're an adult" elif year <= 99: print "you're old enough" else : print "are you serious?"
|