Cs Main Practicals
Cs Main Practicals
Cs Main Practicals
num2 = 6
print("Bye")
else:
#Block2
Output:
print("Bye Bye")
print (1)
print (2)
print (3)
print (4)
print (5)
Output:
3
4
5Print the characters in word PYTHON using for loop for letter in 'PYTHON
Output:
print (letter)
NProgram 6-7
#Print the given sequence of numbers count (10,20,30,40,501 using for loop
NCERT
print (num)
Output:
10
20
30
40
505
Program 6-8
#Program 6-8
the range have been When all the items in usted, the statements executed; the
control d to the statement ng the for loop. While is known in advance the loop
will execute.
For Loop
ble> in <sequence/
if (num2)==0:
Output:
8 is an even Number
if num > 0:
Output:
10
20
30
count = 1
print (count)
count += 1
some statemen
before continu
the loop. These
can be achieved
and continu
respectively.
these statem
to give more
programmer
flow of execu
Output:
#Program 6-12
num = num
if num == 8:
break
Output:
sks
ular
ome
Note: When value of num becomes 8, the break statement is executed and the
for loop terminates.
2022-23
print('End of loop')
Output:
End of loop
ReplyForward
Add reaction