Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed 


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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Starting Out With Python Global Edition

Authors: Tony Gaddis

4th Edition

1292225750, 9781292225753

More Books

Students also viewed these Programming questions

Question

What is a count-controlled loop?

Answered: 1 week ago

Question

What function do you call to retrieve and unpickle an object?

Answered: 1 week ago