Solution: Our Age in Days
Understand how to calculate a person's age in days using Python by multiplying years by days. Explore using arithmetic operators and the print function to display results in this hands-on lesson.
We'll cover the following...
We'll cover the following...
In this example, we’re using Python to calculate age in days by multiplying years by the number of days in a year.
print(22 * 365)
22represents the age in years.365is the number of days in one year.The
*symbol tells Python to multiply the two numbers.The
print()function then displays the result on the screen.