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 Going Further
  3. /Testing and Debugging

Testing and Debugging

Python Programming
+ Upload a Problem
More in Python Going FurtherClasses and ObjectsInheritance and Special MethodsFiles and Data FormatsComprehensions, Iterators and GeneratorsData StructuresTesting and Debugging
10 problems
Type:
1.
Think of a bug that you met while working through this book, or write one on purpose.
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy
2.
This function should give the average of a list, but gives a wrong answer for [2, 4, 6] (it gives…
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy
3.
A pipeline has three stages. For the input "Hello, World", it should give ["hello", "world"], but…
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Medium
4.
Write three properties that must be true for any list x and the function reversed_list(x) that…
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Medium
5.
Fix second_largest so that it gives the second largest different value, and None when there is none.
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Medium
6.
A function longest_word(text) gives the longest word of a text, and when two words are equally…
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy
7.
A test run prints this. How many tests passed?
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Medium
8.
A student writes these names for test methods in a class that tests a Stack class.
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy
9.
A function ticket_price(age) gives 0 for ages under 5, 50 for ages 5 to 12, 100 for ages 13 to 59…
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy
10.
A function is_even(n) should say whether a whole number is even.
High School (11–12), High School (9–10), Undergraduate, General · Testing and DebuggingStemPy LabStemPy Lab
Easy