Demo entry 6749149

glo0balvariables

   

Submitted by anonymous on Jun 12, 2018 at 11:31
Language: Python 3.0 Traceback. Code size: 770 Bytes.

#JAVIER VIDAECHEA 10T opA
#June 12

#declare global variables
ageYears = 0
days = 0
months = 0

#function to calculate age in days
def calcDays(inYears): #pass years as a parameter
    inDays = int(inYears) * 365
    return inDays
#end function------------------------------------------------------

#function to calculate age in days
def calcMonths(inYears):#pass years as a parameter 
    inMonths = int(inYears) * 12
    return inMonths
#end function------------------------------------------------------

ageYears = input("Please input your age in years:  ")
print("Your age in years is",ageYears)

days = calcDays(ageYears)
print("Your age in days is",days)

months = calcMonths(ageYears)
print("Your age in months is",months)
      

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).