Page 124 - 2611_SmartGPT Pro V(5.0) C-7
P. 124
Program18.py Output
File Edit Format Run Options Window Help *
**
for i in range(1, 6):
***
print("*" * i)
****
*****
Hashtag
#Expression: A combination of values, variables, operators and functions that Python evaluates to
produce a result.
#Interpreter: A program that reads and executes Python code line by line, converting it to machine code.
#Execution: The process of running code, where the interpreter executes instructions to produce results.
REVISIT
▶ The order in which program statements are executed is called the flow of control.
▶ The if…else… statement lets your program choose between two options.
▶ The nested if structure allows you to place one if statement inside another.
▶ The ternary operator allows you to perform conditional checks and assign values or execute expressions in a
single line.
▶ The for loop repeats a block of statements a fixed number of times.
▶ A while loop repeats a set of instructions as long as a given condition is true.
▶ Python offers two jump statements—break and continue, which are used within loops.
1. Tick ( ) the correct option.
a. Select the type of flow of control where statements are executed one after another.
(i) Iterative flow (ii) Selective flow
(iii) Sequential flow (iv) Nested flow
b. Identify the function that is used to generate a sequence of numbers.
(i) sequence() (ii) generate()
(iii) range() (iv) list()
122 Computer Science (V5.0)-VII

