Please enable JavaScript.
Coggle requires JavaScript to display documents.
Python 2 - Coggle Diagram
Python 2
while Loop
Used for repetition
Runs as long as condition is true
Condition checked before each loop
Can become infinite if condition never changes
for Loop
Used to repeat a block of code
Often used with range
Runs for a fixed number of times
while condition:
statement
for variable in range():
statement
Syntax:
Syntax:
Python Syntax Rules
Case-sensitive language
Uses indentation instead of brackets
Colon : starts a block of code
No semicolons needed
Statements are simple and readabl
Commenting in Python
Used to explain code
Ignored by Python interpreter
Makes code easy to understand
Types of Comments
Single-line comment: #
Multi-line comment: """ """