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

1226 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Demonstrate a recursive solution to calculate the factorial of a number


Write a recursive function to return the nth Fibonacci number in Python


Create a program that takes in two numbers and returns the highest of the two


Which function is ran when an object is instantiated?


We're here to help

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