Chapter 2:Programming for Everybody (Getting Started with Python) (Python for Everybody Specialization) Answers 2025
Question 1
Which of the following is a comment in Python?
✅ # This is a test
❌ /* This is a test */
❌ * This is a test
❌ // This is a test
Question 2
In the following code:
x = 42
What is “x”?
✅ A variable
❌ A CPU
❌ A function
❌ A constant
Question 3
Which of the following is a bad Python variable name?
✅ #spam
❌ _spam
❌ spam_23
❌ SPAM23
Question 4
Which of the following is not a Python reserved word?
✅ iterate
❌ continue
❌ else
❌ break
Question 5
What does this statement do?
x = x + 2
✅ Retrieve the current value for x, add two to it, and put the sum back into x
❌ Create a function called “x”
❌ Fail due to syntax error
❌ Produce “false”
🧠 Explanation:
This is assignment with arithmetic — it updates the existing value of x.
Question 6
Which part of a mathematical expression is evaluated first?
✅ Parentheses ( )
❌ Multiplication *
❌ Addition +
❌ Subtraction –
🧠 Explanation:
Python follows PEMDAS (Parentheses, Exponents, Multiplication/Division, Addition/Subtraction).
Question 7
What is the value of:
42 % 10
✅ 2
❌ 10
❌ 0.42
❌ 4210
🧠 Explanation:% is the modulus operator — it gives the remainder of division.42 ÷ 10 = 4 remainder 2.
Question 8
What will be the value of x after this executes?
x = 1 + 2 * 3 - 8 / 4
✅ 5.0
❌ 2.0
❌ 4
❌ 8
🧠 Explanation:
Order of operations →1 + (2*3) - (8/4) → 1 + 6 - 2 = 5.0
(Note: division always produces a float.)
Question 9
What will be the value of x when executed:
x = int(98.6)
✅ 98
❌ 99
❌ 100
❌ 6
🧠 Explanation:int() truncates decimals — it doesn’t round.
So int(98.6) → 98
Question 10
What does the Python input() function do?
✅ Pause the program and read data from the user
❌ Connect to the network
❌ Read memory
❌ Take a screenshot
🧠 Explanation:input() waits for user input and returns it as a string.
🧾 Summary Table
| Q# | ✅ Correct Answer | Key Concept |
|---|---|---|
| 1 | # This is a test | Python comments |
| 2 | Variable | Variable definition |
| 3 | #spam | Invalid variable name |
| 4 | iterate | Not a keyword |
| 5 | Retrieve current x + 2 | Assignment operation |
| 6 | Parentheses ( ) | Order of operations |
| 7 | 2 | Modulus operator |
| 8 | 5.0 | Arithmetic precedence |
| 9 | 98 | Type casting (float → int) |
| 10 | Pause program & read user input | input() function |