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

1483 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What is the difference between a FOR loop and WHILE loop and how do I write them?


Create a python code to sum the number from 1 to 10.


Write a simple Python program that asks a user to input their age and name and then return the text: "Hi my name is *NAME*, and I am *AGE* years old."


Demonstrate a recursive solution to calculate the factorial of a number


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