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

1295 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

What is the difference between a float and an integer variable type?


How do I use for loops in Python?


Create an rock, paper, scissors game. The user should input one option, and the computer should play randomly.


Create an algorithm that can be used as a guessing game. Make sure to import random at the start.


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