Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Python Loops & Functions – 70 MCQs + Viva + 50 Exam Programs (Last-Minute Revision Notes 2026) (Part 2)

Beoordeling
-
Verkocht
-
Pagina's
40
Cijfer
A+
Geüpload op
21-04-2026
Geschreven in
2025/2026

Boost your exam preparation with this complete Python revision pack designed for beginners to intermediate students. 70 MCQs (Basic to Advanced) 10 Viva Questions (Exam Ready) Important Programs Explained Loops + Functions (Most Asked Topics) Perfect for Last-Minute Revision Ideal for: • BTech / Diploma Students • School Exams • Viva Preparation

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Python Loops & Functions – 70 MCQs + Viva + 50 Exam
Programs (Last-Minute Revision Notes 2026) (Part 2)
Loops in Python

🔹 Introduction to Loops

In programming, loops are used to repeat a block of code multiple times.

Real-life examples

 Studying daily for 7 days
 Printing numbers from 1 to 100
 Repeating an action until a condition is met

👉 Instead of writing the same code again and again, we use loops.

🔹 Types of Loops in Python

1. for loop
2. while loop

🔹 The for Loop

Used when you know how many times you want to repeat something.

Syntax:

for variable in range(start, stop, step):
# code

🔥 Example 1: Print Numbers from 1 to 5

for i in range(1, 6):
print(i)

Output:

1
2
3
4
5

🔥 Example 2: Print Even Numbers

for i in range(2, 11, 2):
print(i)



1

,Output:

2
4
6
8
10

🔹 The while Loop

Used when you want to repeat until a condition becomes false.

Syntax:

while condition:
# code

🔥 Example 3: Print Numbers from 1 to 5

i = 1
while i <= 5:
print(i)
i += 1

Output:

1
2
3
4
5

🔹 break Statement

Used to exit the loop immediately.

🔥 Example 4

for i in range(1, 10):
if i == 5:
break
print(i)

👉 Stops when i = 5

Output:

1
2
3
4




2

,🔹 continue Statement

Used to skip one iteration.

🔥 Example 5

for i in range(1, 6):
if i == 3:
continue
print(i)

👉 Skips number 3

Output:

1
2
4
5

🔹 Nested Loops

A loop inside another loop.

🔥 Example 6

for i in range(1, 4):
for j in range(1, 4):
print(i, j)

Output:

1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3

🔥 Example 7: Print Stars Pattern

for i in range(5):
print("*" * (i + 1))

Output:

*
**
***



3

, ****
*****

🔥 Example 8: Reverse Counting

for i in range(10, 0, -1):
print(i)

Output:

10
9
8
7
6
5
4
3
2
1

🔥 Example 9: Multiplication Table

num=int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)

Output:

Enter a number: 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

🔥 Example 10: Sum of First N Numbers

n=int(input("Enter value of n: "))
total = 0
for i in range(1, n + 1):
total += i
print("Sum is:", total)

Output:

Enter value of n: 5
Sum is: 15




4

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
21 april 2026
Aantal pagina's
40
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$3.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
sumit_9999

Maak kennis met de verkoper

Seller avatar
sumit_9999 Self Employed
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
2 weken
Aantal volgers
0
Documenten
9
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen