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

1495 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Write a short program to print all the even numbers 1 to 100


Give a segment of python code that will print the numbers 1 to 7, each one on a new line


What is the difference between using range() and a list of values?


Write a basic program to output the lowest of 3 input numbers. (You may omit error checks on your inputs)


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