HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_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 →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

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

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Quizzes
  2. /Starting from ten, the program halves the number when it is even, and triples it and adds one when it is odd, counting the steps until it reaches one. The while statement has an else part. What does the program print?
Python ProgrammingMediumHigh School (9–10)Python Basics › LoopsPCEP (Python Institute)
StemPy LabCreated by StemPy Lab

Starting from ten, the program halves the number when it is even, and triples it and adds one when it is odd, counting the steps until it reaches one. The while statement has an else part. n = 10 steps = 0 while n != 1: if n % 2 == 0: n //= 2 else: n = 3 * n + 1 steps += 1 else: print("done", end=" ") print(steps) What does the program print?

Log in to save
← All Quizzes
← 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?Two loops build a list of two-digit codes. The inner loop uses both continue and break. What does the program print? →
More onPython Basics › Loops

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. In the middle of a for loop, the function tally puts 10 into i. It returns a sum and i together.…Hard
  2. A function should return the largest number of a list. For a list of negative numbers it gives the…Medium
  3. A while loop asks the function more whether to go on. That function also shows the number it was…Medium
  4. A function puts new numbers at the end of a list while a for loop runs over range(len(vals)). What…Medium
  5. A program searches a table, stored as a list of lists, for a negative number. It uses break…Hard
All questions on this topic →

Problems on this topic

  1. This loop should show the even numbers from 2 up to and including 10…Medium
  2. Write a program that asks for a password, again and again, until the user types python123…Medium
  3. Find the first number from 100 upwards that can be divided by both 6 and 8…Easy
  4. Asha saves 45 rupees every week, and has 0 at the start…Easy
All problems on this topic →