Print each student with their mark, numbered from 1, in the form 1. Rahim: 72.
What to build
A numbered list made from two matching lists.
Requirements
- Read the names and the marks.
- Print each student as
1. Name: mark, numbered from 1.
Input
Two lines: names separated by spaces, then the same number of marks.
Output
One line per student.
Constraints
There are at most 100 students, and the two lines have the same number of items.
Example
Input:
Rahim Nadia
72 91
Output:
1. Rahim: 72
2. Nadia: 91
Why it works
zip pairs each name with its mark, and enumerate numbers those pairs, so no index is written by hand.
Examples
Example 1 · Input
Rahim Nadia 72 91
Expected output
1. Rahim: 72 2. Nadia: 91
Example 2 · Input
Solo 100
Expected output
1. Solo: 100
Prompts inside input() are ignored when checking, so input("n: ") is fine.
Hints
Hint 1
zip pairs each name with its mark.
Hint 2
enumerate(..., start=1) counts from 1.
Solution
Show one correct solution (try it yourself first)
names = input().split()
marks = input().split()
for i, (name, mark) in enumerate(zip(names, marks), start=1):
print(f"{i}. {name}: {mark}")