Define a function that takes in the age of the user and adds it to an output sentence such as "You are ..... old".

def userName(): age = int(input("How old are you? ")) print(("You are {} old.").format(age))userName()

LR
Answered by Lucia R. Python tutor

1486 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

How would you loop over every key and value in a python dictionary?


Explain how you would write a python program that takes a rectangle and a point in a 2D space as command-line arguments and checks if they intersect.


Which function is ran when an object is instantiated?


Create an rock, paper, scissors game. The user should input one option, and the computer should play randomly.


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

MyTutor is part of the IXL family of brands:

© 2025 by IXL Learning