Write a program that reads a string and an integer and prints a name and age message.
Input will consist of a single line containing a string n and a natural number a where
|n| ≤ 30, i.e.: the string n is no more than 30 characters
0 ≤ a ≤ 180
Your program should produce a single line containing the message:
<n> is <a> years old.
with <n>
replaced by n and <a>
replaced by a.
John 23
John is 23 years old.
Jane 32
Jane is 32 years old.
Input is given on a single line as shown above, e.g.: John 23
,
that is “John[space]23[enter]”.
If you are having trouble with this exercise,
check this explanation on
how to read two values on a single line
in Python, C and Haskell.
This exercise is easier if you solve hello, hi1 and repeat1 first.
try also: swap1
Copyright © 2020-2021 Rudy Matela
This text is available under the CC BY-SA 4.0 license.
Originally available on cscx.org/age1