S.Y.I.T Sem 3 Python Practical | Python| Python practical 1a| Print name and age +100 | python for beginner
Hello reader's ,
This blog is for those students who are studying in second year of information technology. This blog is for practical of python subject which is in sem 3. In this blog you are going to see that how you can ask user to enter their name and age. Print out a message addressed to them that tells them the year that they will turn 100 year old.
For performing this practical you must have install python on your laptop or pc. to download python - https://www.python.org/downloads/
go to the link and download python and you need a IDE which supports python, i am using VS Code, you can use python IDE too.
vs code screen |
After the successful installation open ide and type the code or simply copy the code from given link in below and run it to see the output.
code -
name = input("Enter your name: ")
age = int(input("Enter your age: "))
year = str((2021 - age)+100)
print(name + "will be 100 years old in the year"+year)
Comments
Post a Comment
Thank you for sharing this.
You’re helping us become better. Want to stay in the loop? Subscribe to our YouTube channel.