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

1473 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

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


How do you define a class in python


How do For Loops work?


Ask the user for a number and output the smallest divisor, bigger than one, for the inputted number. Output "Prime" if the number is a prime 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