Assignment
Problem statement:
Create a program which ask for your age, name and then print your name
and age along with saying that you will be 100 years old in what year.
Hints:
name =
age =
year =
print(name + ” will be 100 years old in the year ” + year)
age =
year =
print(name + ” will be 100 years old in the year ” + year)
use the above code snippet as some hints and attempt to write a basic
code.
solution:
my_dict = {'name':'','age':0,'year':0} # Defining dictory
my_dict = {'name':'','age':0,'year':0} # Defining dictory
# Assigning values to keys
name = input('Enter Name:')
my_dict['name'] = name
age = input('Enter Age:')
my_dict['age'] = int(age)
year = input('Enter Year:')
my_dict['year'] = int(year)
d = 100 - my_dict['age']
# finding remaining years from 100
in_year = my_dict['year']+d # adding remaining years from 100 into
current age
print('%s age is: %s' %(my_dict['name'],in_year))
0 Comments