Professional Documents
Culture Documents
>> CONTROL STATEMENTS
1) SELECTIVE STATEMENTS
a) if
b) if-else
c) if-else-if (nested if-else)
d) if-else ladder
eg. nums = []
for i in range(1, 11):
print(nums)
Syntax:
while condition
statements(code)
Eg. num = 1
even_numbers = []
while num <= 10:
if num % 2 == 0:
even_numbers .append(num)
num += 1
print("Even Numbers list: ", even_numbers )
3) JUMPING STATEMENTS
a) break
b) continue
c) pass
d) return
e) exit
etc.
>> Array
print(students)
Because each item has its own index number, we can access each
item in our array. We can do so by calling our list and specifying
an index number, like so:
print(students[2])
output : "Catherine"
Methods: