DEV Community

DDSRY
DDSRY

Posted on • Updated on

Python Program – Print out a message that tells them which year he/she will become 100 years old.

In this blog post, you will understand that How to Write a program in Python that asks the user to enter their name and age. Print out a message that tells them which year he/she will become 100 years old.

.

Source Code

.

name = str(input(“Enter Your Name : “))

age = int(input(“Enter Your Age : “))

years = str((2020-age)+100)

print(name+”will be 100 years old in the year of “+years)

.

Above Python Program Explanation below :
In the above program,

.

first, we had taken two inputs from the user,

.

Enter Your Name
Enter Your Age
In the first input, we have taken the name of the user for that we have to use str (String),

.

the second thing we have taken the Age of user for that we have to use int (Integer).

.

After that, we had done some calculations

.

years=str((2020-age)+100)

.

The above statements is used to find in which year he/she will become 100 years old.

.

We have use str before that calculation because to add str + int (Concatenation)

Read more...

Top comments (3)

Collapse
 
ebugewa profile image
ebugewa

Hi Can you teach python?

Collapse
 
ddsry21 profile image
DDSRY

Yes💻

Collapse
 
ebugewa profile image
ebugewa

Thank you very much