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

1400 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Which function is ran when an object is instantiated?


Manually implement a function that finds the smallest value in a list of integers and print it.


[Exam style] Python is an interpreted language. Explain what this means and how interpreted languages differ from compiled languages.


Describe both For-loops and While-loops and explain how you can simulate the effect of a for loop with a while loop with an example.


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