0% found this document useful (0 votes)
19 views3 pages

g7 Python Ws03 Answer Key

Uploaded by

lamia.chow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views3 pages

g7 Python Ws03 Answer Key

Uploaded by

lamia.chow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name:

Grade: 7 Section:

Teacher: Fahria Rahman Date:

Topic: Python Module A

Section 1: Fill in the Blanks

1. The __________ function is used to show output in Python.


→ Answer: print
2. Python comments begin with the __________ symbol.
→ Answer: #
3. Python is a __________-level programming language.
→ Answer: high
4. We use an __________ like PyCharm to write Python code.
→ Answer: editor / IDE
5. A __________ is an error in the program’s rules or structure.
→ Answer: syntax error
6. The output of print("Hello") is __________.
→ Answer: Hello
7. Python was created by __________ van Rossum.
→ Answer: Guido
8. The sep keyword in print() is used to change the __________ between words.
→ Answer: separator
9. print("Python", "Rocks", sep="-") will output: __________.
→ Answer: Python-Rocks
10. Python files are saved with the extension __________.
→ Answer: .py

🔁 Section 2: Short Questions and Answers

1. What is a loop in Python?


🔁 A loop is used to repeat a set of instructions multiple times.
2. What is a for loop used for in Python?
🔁 It is used to repeat something a fixed number of times.
3. What is a while loop used for in Python?
🔁 It repeats as long as a condition is true.
4. Which loop is better when we know how many times to repeat?
🔁 The for loop.
5. Which loop is used when we don’t know how many times to repeat?
🔁 The while loop.
6. What does range(5) mean in a for loop?
🔁 It gives numbers from 0 to 4.
7. What is the output of this code?

for i in range(3):

print(i)

8. What is the basic syntax of a for loop?


🔁

for i in range(5):

print(i)

9. How does a while loop stop?


🔁 It stops when the condition becomes false.
10. Can loops be used to print numbers?
🔁 Yes, both for and while loops can print numbers.

Section C: Multiple Choice Questions

[Link] Correct Answer Explanation


1 C. print() The print() function displays output in Python.
2 C. Python Python is a programming language; HTML and CSS are not.
3 B. Writing Python code PyCharm is an IDE used to write Python code.
[Link] Correct Answer Explanation
4 B. # Python comments begin with the # symbol.
5 B. A programming language Python is not a game, calculator, or music app.
6 B. print() print() is used to show output in Python.
7 C. # The # symbol is used for comments in Python.
8 C. print("Hello") This is the correct syntax in Python 3.
9 B. Writing Python code PyCharm is used for writing Python programs.
10 C. Hi The output of print("Hi") is simply Hi.

The End

You might also like