Problem 4: Comment-the-Code Exercise
Easypython
Problem Description
You are given a short block of Python code with no comments. Rewrite it, adding a clear one-line comment above each statement explaining what that statement does. (This is a conceptual/practice exercise rather than a numeric one — the goal is to practice reading and documenting code.)
Input
A short, uncommented Python snippet (3–5 lines) involving print(), input(), and one arithmetic operation.
Output
The same snippet, with a meaningful comment placed above every line.
Constraints
- Every line of code must have exactly one comment above it.
- Comments must be written in your own words, not just restating the code symbol-by-symbol.
Example Input
textname = input("Enter name: ") age = input("Enter age: ") print(name, age)
Example Output
text# Ask the user to type their name and store it name = input("Enter name: ") # Ask the user to type their age and store it age = input("Enter age: ") # Display both the name and age together print(name, age)
Concepts Covered
Comments, code readability, input(), print().