0% found this document useful (0 votes)
18 views1 page

Online Python Compiler Example

This Python code takes a person's birth year and the current year as input, calculates their age, and prints a birthday message if the date matches their birthday, displaying their name and the message "Happy [age]th Birthday". It imports the time module, defines variables for the current year, a sample birth year, and a name, calculates the age by subtracting birth year from current year, checks if the date matches the birthday date, and prints a personalized birthday greeting if it does.

Uploaded by

Ashrith Boppana
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Online Python Compiler Example

This Python code takes a person's birth year and the current year as input, calculates their age, and prints a birthday message if the date matches their birthday, displaying their name and the message "Happy [age]th Birthday". It imports the time module, defines variables for the current year, a sample birth year, and a name, calculates the age by subtracting birth year from current year, checks if the date matches the birthday date, and prints a personalized birthday greeting if it does.

Uploaded by

Ashrith Boppana
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Interactive

Python Online Python Course


Compiler

[Link]  Run  Shell  Clear 

1 Input: >
2
3 import time
4 year=[Link]
5 birth_year=2009
6 age=year-birth_year
7 date=[Link]
8 name="Ashrith"
9 if date=19.02:
10 print("Happy",age,"th Birthday"
        ,name)
11
12 Output:
13
14 Happy 14th Birthday Ashrith
15
16

You might also like