0% found this document useful (0 votes)
19 views3 pages

loop output based questions

Uploaded by

Pinki Tonger
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)
19 views3 pages

loop output based questions

Uploaded by

Pinki Tonger
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/ 3

FR.

AGNEL SCHOOL, GREATER NOIDA


WORKSHEET (INFORMATICS PRACTICES)

Write the output of the following codes :

1. Question 1:

i=1
while i < 5:
print(i, end=" ")
i += 1

2. Question 2:

for i in range(3):
print(i, end=", ")

3. Question 3:

x = 10
while x > 5:
print(x, end=" ")
x -= 2

4. Question 4:

for i in range(2, 10, 2):


print(i, end="-")

5. Question 5:

i=0
while i < 10:
i += 3
print(i, end=" ")

6. Question 6:

for i in range(5, 0, -1):


print(i, end=" ")

7. Question 7:

count = 1
while count <= 3:
for i in range(1, count+1):
print(i, end="")
print()
count += 1
8. Question 8:

for i in range(4):
for j in range(i+1):
print("*", end="")
print()

9. Question 9:

i=1
while i < 4:
j=1
while j < 3:
print(i*j, end=" ")
j += 1
i += 1

10. Question 10:

for i in range(1, 6):


print(i * "*")

11. Question 11:

x=0
while x < 10:
print(x, end=" ")
x += 2

12. Question 12:

for i in range(3, -1, -1):


print(i, end=", ")

13. Question 13:

i=5
while i >= 1:
print(i * "#")
i -= 1

14. Question 14:

for i in range(2, 10, 3):


print(i, end=" ")
15. Question 15:

i=1
while i <= 10:
if i % 2 == 0:
print(i, end=", ")
i += 1

16. Question 16:

for i in range(1, 4):


for j in range(1, 4):
print(i+j, end=" ")
print()

17. Question 17:

i = 10
while i >= 2:
print(i, end=" ")
i -= 3

18. Question 18:

for i in range(1, 5):


for j in range(i):
print(i, end="")
print()

19. Question 19:

x=0
while x < 5:
for y in range(x):
print(y, end="")
print()
x += 1

20. Question 20:

python
Copy code
for i in range(3):
for j in range(i, 3):
print(j, end=" ")
print()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy