Instructions
myinfo.py
1 # Put your code here
Write and test a program that accepts
the user's name (as text) and age (as a
number) as input
The program should output a sentence
containing the user's name and age.
An example of the program input and
output is shown below:
Enter your name: Alex
Enter your age: 23
Alex ls 23 years old.

Respuesta :

Answer:

#here is code in python

#read the name

name=input("Enter your name:")

# read the age as integer

age=int(input("Enter your age:"))

#print the output in the required format

print("{} is {} years old.".format(name,age))

Explanation:

Read the name from user and assign it to variable "name".Then read the age from  user and assign it to variable "age". In the next line print the output as required using the format function.

Output:

Enter your Sam                                                                                                                                        

Enter your age:24                                                                                                                                            

Sam is 24 years old.