02-09-03 i/o - input and output

Ace your homework & exams now with Quizwiz!

Write some code that reads in a name as a string and an age as an integer into the variables name and age. It then prints the message "The age of NAME is AGE" on a line by itself, where NAME and AGE represent the values read into the variables name and age respectively.For example, if your code read in "Rohit" and 70 then it would print out "The age of Rohit is 70" on a line by itself. There should NOT be a period in the output.

name = input() age = eval(input()) print("The age of", name, "is", age)

Write some code that reads a value into the variable name then prints the message "Greetings, NAME" on a line by itself, where NAME is replaced the value that was read into name. For example, if your code read in "Rachel" it would print out "Greetings, Rachel" on a line by itself.

name = input() print("Greetings,", name)

Write some code that reads a value representing a name into the variable name then prints the message "Greetings, NAME!!!" on a line by itself where NAME is replaced the value that was read into name. For example, if your code read in "Hassan" it would print out "Greetings, Hassan!!!" on a line by itself.

name = input() print("Greetings,", name+"!!!")


Related study sets

Chemistry Module 5 Gauth Math checked

View Set

NU142- Chapter 54: Management of Patients With Kidney Disorders

View Set

BAM410 - ORGANIZATIONAL THEORY AND BEHAVIOR - Unit Exam 4

View Set

Stats Test 3 (Ch. 12-14) Class Notes

View Set