← Back to Menus & Validation
Question 447
Aligned Name And Age
Aligned Name And Age
Read a name with the prompt Name: and an age with the prompt Age: (keep the age as text). Print a header line with the words Name and Age, then a row for the person, both using the format spec {name:<20} {age:>3}: the name left-aligned in a field 20 wide, one space, then the age right-aligned in a field 3 wide. Input: two lines. Both prompts print on the first output line in front of the header, since input() does not end the line.
Expected Output:
Name: Age: Name Age Maya 31
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Menus & Validation
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.