Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that asks the user to enter his name and age and prints on the screen the year in which he was
Write a program that asks the user to enter his name and age and prints on the screen the year in which he was born and when he will be doubled in age. Sample Run: Enter your name: Sami Hi Sami, what is your age? 21 You were born in 2001 and you will have 42 years old on 2043
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Python program that achieves the desired functionality Python def calculatebirthanddoubleagename age This function takes a name and age as input and calculates the birth year and year when the person will be double their age Args name The users name as a string age The users age as an integer bornyear 2024 age doubleageyear bornyear 2 age printfHi name you were born in bornyear and you will be doubled in age on doubleageyear Get user input name inputEnter your name age intinputHi what is your age formatname Call the function to calculate and print results calculatebirthanddoubleagename age Explanation Function definition The code defines a function calculatebirthanddoubleage ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started