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()

Answered by Lucia R. Python tutor

1267 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Write a program that takes a value x and then outputs x Fibonnaci numbers. E.g. if x=6 output would be 1 1 2 3 5 8


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


What does __init__ mean?


Demonstrate a recursive solution to calculate the factorial of a number


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences