index | submit | rank | book

age1 – Name and Age (easy version)

Write a program that reads a string and an integer and prints a name and age message.

John is 23 and Jane is 32

Input and Output

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.

Example input 1

John 23

Example output 1

John is 23 years old.

Example input 2

Jane 32

Example output 2

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.

try first: repeat1 hi1

try also: swap1

try next: triple1 inc1

index | submit | rank | book

Copyright © 2020-2021 Rudy Matela
All rights reserved