Created
May 26, 2017 09:53
-
-
Save ashokbharat/017fbd580a19783976e48a6366593809 to your computer and use it in GitHub Desktop.
Practice Python Exercises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Program that asks the user to enter their name and their age. Print out a message addressed to them that tells them | |
the year that they will turn 100 years old.''' | |
import datetime | |
name=str(input("Please enter your name")) | |
age=int(input("Please enter your age if you are aged below 100")) | |
year_turning_100_years = datetime.datetime.now().year + (100-age) | |
print("Hello %s, You shall be turning 100 years old in %d:" %(name,year_turning_100_years)) | |
'''Add on to the previous program by asking the user for another number and printing out that many copies of the previous message.''' | |
message = "Hello "+name+" You shall be turning 100 years old in "+str(year_turning_100_years) | |
count = int(input("Enter any random number")) | |
for i in range(0,count): | |
print(message) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment