Skip to content

Instantly share code, notes, and snippets.

@stahnni
Created February 25, 2017 00:10
Show Gist options
  • Save stahnni/3de2410ebe5102f7cec6e6e2b31abbe2 to your computer and use it in GitHub Desktop.
Save stahnni/3de2410ebe5102f7cec6e6e2b31abbe2 to your computer and use it in GitHub Desktop.
Character Input code
"""
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.
Extras:
Add on to the previous program by asking the user for another number and printing out
that many copies of the previous message. (Hint: order of operations exists in Python)
Print out that many copies of the previous message on separate lines. (Hint: the string
"\n is the same as pressing the ENTER button)
"""
def character_input():
name = input("Enter your name: ")
age = int(input("How old are you: "))
age_hun = int(input("You will turn 100 in: "))
print("You said your name is %s and that you are %s years old" % (name, age))
print("That means that you will be a hundred years old in the year %s" % (age_hun))
character_input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment