Created
April 30, 2017 13:44
-
-
Save ehedaoo/2da7318fba8a99cde8ae47cb821fc465 to your computer and use it in GitHub Desktop.
Create a 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.
Add on to the previous program by asking the user for another number and printing out that many copies of the previous message.
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
# Create a 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. | |
# Add on to the previous program by asking the user for another number | |
# and printing out that many copies of the previous message. | |
import datetime | |
def call1(): | |
print("You will turn 100 in " + str(int(100-age) + int(year_now.year))) | |
name = input("Hello! Please enter your name: ") | |
print("Hello " + name) | |
age = int(input("Enter your age: ")) | |
year_now = datetime.datetime.now() | |
rep = int(input("No. of times you want the text to be printed: ")) | |
# print(year_now.year) | |
for i in range(rep): | |
call1() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment