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

1334 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Explain how python programs are structured and give an example of how methods are initiated


What is the difference between DFS and BFS? Where can I apply each?


Write a function that takes a string, and outputs that string formatted in camelcase. (alternating upper and lower case for each character, e.g. cAmElCaSe)


How can you take a list of numbers and add 3 to every number in the list using only one line of code?


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences