HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClassesGroups

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Blog

Account

  • Dashboard
  • My Content
  • Profile
  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Python Basics
  3. /Loops

Loops

Python Programming
+ Upload a Problem
More in Python BasicsGetting Started with PythonVariables and Data TypesOperators and ExpressionsInput and OutputStringsConditionals: if, elif, elseLoopsListsFunctionsMini Projects
34 problems
Type:
1.
The list is marks = [45, 78, 90, 62, 38, 85, 71].
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Easy
2.
This loop should show the even numbers from 2 up to and including 10.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
3.
Write a program that asks for a password, again and again, until the user types python123.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
4.
Find the first number from 100 upwards that can be divided by both 6 and 8.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
5.
Asha saves 45 rupees every week, and has 0 at the start.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
6.
How many times does the line print("x") run?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
7.
Print a rectangle of stars with 4 rows and 7 columns.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
8.
This program should show the sum of the numbers 1 to 4, which is 10.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
9.
How many numbers does each row have, and which is the last number?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
10.
From the list [3, 1, 3, 2, 1], make a new list that has each value only once, in the order of the…
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Hard
11.
Build the list of the squares of 1 to 6: [1, 4, 9, 16, 25, 36].
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Medium
12.
A mark of 60 or more is a pass. How many of [72, 85, 64, 90, 58] passed?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Medium
13.
Find the highest mark, the lowest mark and the difference between them for [72, 85, 64, 90, 58].
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Easy
14.
Find the total and the average of the marks 72, 85, 64, 90 and 58.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Lists, LoopsStemPy LabStemPy Lab
Medium
15.
Take a number. If it is even, halve it. If it is odd, multiply it by 3 and add 1.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Hard
16.
A secret number is 42. The player types 50, then 30, then 42. What does the game show?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
17.
Show the odd numbers from 1 to 9 by skipping the even ones with continue.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
18.
Find the first number above 50 that is divisible by 7. Use a loop with break.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
19.
Why does this program never stop? Fix it so that it shows 0, 1, 2, 3, 4.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
20.
Use a while loop to find how many digits 4729 has and what the sum of its digits is.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Hard
21.
Add the numbers 1, 2, 3, … one after the other.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
22.
Asha saves 150 rupees every month. How many months does she need to save at least 1000 rupees?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
23.
Start with 1 and keep doubling the number until it is more than 100.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Medium
24.
Show the numbers from 1 to 5 with a while loop.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Easy
25.
Count the vowels in the word education.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · LoopsStemPy LabStemPy Lab
Hard
Page 1 of 2

Showing 1–25 of 34