0% found this document useful (0 votes)
2 views6 pages

Looping Statements

The document outlines a Python programming course (BTCOL406) at Gramin Technical and Management Campus, focusing on implementing looping statements. It includes practical code examples for 'for', 'while', and 'do-while' loops, demonstrating how to print sequences, calculate factorials, and generate Fibonacci series. Additionally, it provides code for accessing lists using loops.

Uploaded by

syediliyas8282
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Looping Statements

The document outlines a Python programming course (BTCOL406) at Gramin Technical and Management Campus, focusing on implementing looping statements. It includes practical code examples for 'for', 'while', and 'do-while' loops, demonstrating how to print sequences, calculate factorials, and generate Fibonacci series. Additionally, it provides code for accessing lists using loops.

Uploaded by

syediliyas8282
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

BTCOL406 :-Python Programming

Gramin Technical And Management Campus Nanded


Department of computer Engineering (Degree)
Subject Name/code :- BTCOL406 Python Programming

Student Name :- Syed Iliyas PRN No :- 24025081245527

DOP:- __/__/2025 DOC:- __/__/2025

Aim :- Program to Implementing Looping Statements.


➢ For Loop Questions
➢ Practical Code –
print('Numbers 1 to 10 In Sequence')
for i in range (1,11,):
print(i, end=" ")
print('\nNumbers 1 to 10 Which Are Divisible By 2 In Reverse Order')
for j in range (11,1, -1):
if j%2==0 :
print(j, end=' ')
num = int (input('\nEnter The Number '))
fact = 1
for i in range(1 ,num + 1):
fact = fact*i
print ('Factorial OF ',num,' is',fact)
n1 = int (input('Enter The Number '))
fab1 = int(0)
fab2 = int(1)
for i in range(1,n1 + 1):

Looping Statements Page 1


BTCOL406 :-Python Programming

print (fab1, end= ' ')


fab1, fab2 = fab2, fab1 + fab2
➢ Practical Output –

➢ While Loop Questions


➢ Practical Code –
print('Numbers 1 to 10 In Reverse Order')
n2 = 10
while n2>0:
print (n2,end= ' ')
n2-=1
a = int (input('\nEnter The Number For Factorial '))
fact = 1
while a>0:
fact = fact*a

Looping Statements Page 2


BTCOL406 :-Python Programming

a-=1
print ('Factorial is',fact)
b = int (input('Enter The Number Fabonices Series '))
f1 = 0
f2 = 1
while b>0:
f1, f2 = f2, f1 + f2
print (f1,end=' ')
b-=1
➢ Practical Output –

Looping Statements Page 3


BTCOL406 :-Python Programming

➢ Do-While Loop Questions


➢ Practical Code –
print('Numbers 1 to 10 Which Are Not Divisible By 2 - ')
num = 1
while True:
if num%2 != 0:
print(num, end=" ")
num += 1
if num ==11:
break
print()
while True:
num = int(input("Enter a number to find factorial "))
fact = 1
while num > 0:
fact = fact*num
num -= 1
print('Factorial is', fact)
break
while True:
num = int(input("Enter the number of terms for Fibonacci series "))
a=0
b=1
count = 0
while count < num:
print(a, end=" ")
a, b = b, a + b
Looping Statements Page 4
BTCOL406 :-Python Programming

count += 1
print()
break
➢ Practical Output –

❖ List Using For Loop Questions


➢ Practical Code –
print('List With Loop Code Questions - ')
list1 = [8,7,9,9,9,5,7,8,5,2]
print('Accessing List Using For Loop ')
for i in list1:
print (i, end=" ")
print('\n')

Looping Statements Page 5


BTCOL406 :-Python Programming

➢ Practical Output –

Looping Statements Page 6

You might also like