View on GitHub

Simple notes

just my notes for my own reading.

Python

Ex1:

Input your name Input your year of birth Output your name and your age.

from datetime import datetime

currentYear = datetime.now().year

name = input("Enter your name: ")
year = int(input("Enter your Year of Birth: "))
result = ("Your name is {name}, this year you are {age} year old".format(name = name, age = currentYear - year))

print (result)