Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Community ▾
A
A
Quizzes
/
Two nested counting loops add up numbers. The inner range starts at the outer variable, so the inner loop gets shorter each time round. What does the program print?
Python Programming
Medium
High School (9–10)
Python Basics › Loops
PCEP (Python Institute)
Created by
StemPy Lab
Stuck? Show a hint
Two nested counting loops add up numbers. The inner
range
starts at the outer variable, so the inner loop gets shorter each time round.
total = 0 for i in range(1, 4): for j in range(i, 4): total += j print(total)
What does the program print?
18
10
6
14
Check Answer
Log in to save
Tag someone
⚑ Report
← All Quizzes
← An if statement has another if inside it, and the first test compares two strings. What does the program print?
A loop counts vowels in a short phrase. It skips spaces, it can stop early, and it has an else block. What does the program print? →
More on
Python Basics › Loops
Discussion (0)
Log in
to join the discussion.
Loading…
All questions on this topic →
Problems on this topic
This loop should show the even numbers from 2 up to and including 10…
Medium
Write a program that asks for a password, again and again, until the user types python123…
Medium
Find the first number from 100 upwards that can be divided by both 6 and 8…
Easy
Asha saves 45 rupees every week, and has 0 at the start…
Easy
All problems on this topic →