← Back to User Input
Question 196
Introduce Two People
Introduce Two People
Ask for two people in turn with the prompts Name 1? , Age 1? , Name 2? and Age 2? (each ending in a space), converting each age with int(), then print two lines: <name1> is <age1> and <name2> is <age2>. and Together they are <the two ages added>. Input: four lines in that order, a name then an integer, twice. The prompts are part of the output and input() does not add a newline, so all four prompts and the first sentence share the first output line, as shown in Expected Output.
Expected Output:
Name 1? Age 1? Name 2? Age 2? Ana is 20 and Ben is 22. Together they are 42.
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
User Input
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.