Last active
November 22, 2017 07:45
-
-
Save azdafirmansyah/faf65568625c08313d08fbe06963c48d to your computer and use it in GitHub Desktop.
Challenge - Character Input
This file contains hidden or 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. | |
from datetime import datetime | |
current_year = datetime.now().year | |
while True: | |
try: | |
name = str(input("Name :")) | |
if len(name) == 0: | |
print("Please input name") | |
else: | |
print("your name is :",name) | |
age = int(input("Age :")) | |
if age > 0: | |
print("Age is : ", age) | |
temp = 100 - age | |
result = temp + int(current_year) | |
print("You become 100 at :",result) | |
else: | |
print("please input age") | |
except Exception as e: | |
print("Please Check Your Input ",e) | |
finally: | |
print("--------------------") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment