Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Groups
Community ▾
A
A
Problems
/
Python Basics
/
Loops
Loops
Python Programming
+ Upload a Problem
More in Python Basics
Getting Started with Python
Variables and Data Types
Operators and Expressions
Input and Output
Strings
Conditionals: if, elif, else
Loops
Lists
Functions
Mini Projects
All Levels
Middle Stage (6–8)
High School (9–10)
High School (11–12)
Undergraduate
General
All
Easy
Medium
Hard
Sort
Mixed
Newest first
Oldest first
A to Z
34 problems
Type:
Any
Conceptual
Numerical
Python-Coded
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, Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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, Loops
StemPy 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, Loops
StemPy 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, Loops
StemPy 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, Loops
StemPy 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, Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy 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 · Loops
StemPy Lab
Easy
25.
Count the vowels in the word education.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Loops
StemPy Lab
Hard
←
Previous
Page 1 of 2
1
2
Next
→
Showing 1–25 of 34