PCEP-30-02 Module 3 Study Guide | Boolean Values, Conditional Execution,
Loops & Logic 2026
if-elif-else statement - correct answer ✔✔cascade- way of assembling the statetment.
if the_weather_is_good:
go_for_a_walk()
elif tickets_are_available:
go_to_the_theater()
elif table_is_available:
go_for_lunch()
else:
play_chess_at_home()
range() function - correct answer ✔✔generates a sequence of numbers. It accepts integers and
returns range objects.
The syntax of range() looks as follows: range(start, stop, step),
where:
**start is an optional parameter specifying the starting number of the sequence (0 by default)
**stop is an optional parameter specifying the end of the sequence generated (it is not
included),
**step is an optional parameter specifying the difference between the numbers in the sequence
(1 by default.)
, ex:
for i in range(3):
print(i, end=" ") # Outputs: 0 1 2
for i in range(6, 1, -2):
print(i, end=" ") # Outputs: 6, 4, 2
bitwise operators - correct answer ✔✔&, |, ^, ~, <<, >>
***allow you to manipulate single bits of data.
& (ampersand) - bitwise conjunction;
| (bar) - bitwise disjunction;
~ (tilde) - bitwise negation;
^ (caret) - bitwise exclusive or (xor).
& requires exactly two 1s to provide 1 as the result;
| requires at least one 1 to provide 1 as the result;
^ requires exactly one 1 to provide 1 as the result.
Bitwise Right Shift Operator: >>
Loops & Logic 2026
if-elif-else statement - correct answer ✔✔cascade- way of assembling the statetment.
if the_weather_is_good:
go_for_a_walk()
elif tickets_are_available:
go_to_the_theater()
elif table_is_available:
go_for_lunch()
else:
play_chess_at_home()
range() function - correct answer ✔✔generates a sequence of numbers. It accepts integers and
returns range objects.
The syntax of range() looks as follows: range(start, stop, step),
where:
**start is an optional parameter specifying the starting number of the sequence (0 by default)
**stop is an optional parameter specifying the end of the sequence generated (it is not
included),
**step is an optional parameter specifying the difference between the numbers in the sequence
(1 by default.)
, ex:
for i in range(3):
print(i, end=" ") # Outputs: 0 1 2
for i in range(6, 1, -2):
print(i, end=" ") # Outputs: 6, 4, 2
bitwise operators - correct answer ✔✔&, |, ^, ~, <<, >>
***allow you to manipulate single bits of data.
& (ampersand) - bitwise conjunction;
| (bar) - bitwise disjunction;
~ (tilde) - bitwise negation;
^ (caret) - bitwise exclusive or (xor).
& requires exactly two 1s to provide 1 as the result;
| requires at least one 1 to provide 1 as the result;
^ requires exactly one 1 to provide 1 as the result.
Bitwise Right Shift Operator: >>