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 Essentials
  3. /Errors and Exceptions

Errors and Exceptions

Python Programming
+ Upload a Problem
More in Python EssentialsDictionariesTuples and SetsErrors and ExceptionsModules and LibrariesSearching and SortingRecursionText ProcessingEssentials Projects
27 problems
Type:
1.
Write a function above_mean(marks) for a dictionary of name and mark.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
2.
Choose a project: a program that keeps the scores of a quiz game and shows who is winning.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Easy
3.
Write three small functions square(n), double(n) and negate(n), and a dictionary operations that…
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
4.
Say which error each line gives, before you run it.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Easy
5.
The data reader of the lesson reports each bad line with a message.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
6.
For each job, say whether you would look before you leap (an if) or try and catch (try and except)…
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Easy
7.
Write a function percent(part, total) that gives part / total * 100.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
8.
The sorted marks are 64, 78, 78, 85, 92.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Hard
9.
What does statistics.mean([]) do? Write safe_mean(values) that gives None for an empty list and the…
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Hard
10.
Rank the marks {"Asha": 92, "Ravi": 78, "Meera": 85, "Kabir": 64, "Zoya": 78} from the highest.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
11.
Five students have the marks 92, 78, 85, 64, 78.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
12.
The secret is mjqqt. The letter q appears twice, so the rule guesses that q stands for e.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Hard
13.
In a long English secret, the most common letter is x.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
14.
Count the letters of balloon with a dictionary.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
15.
The book is {"meera": "99887", "asha": "98765", "ravi": "91234", "kabir": "90000"}.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Medium
16.
The book has asha and ravi. What happens with contacts["zoya"]?
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Easy
17.
Write add(name, number) for the contact book.
High School (9–10), High School (11–12), Undergraduate, General · Essentials Projects, Dictionaries, Errors and Exceptions, Text ProcessingStemPy LabStemPy Lab
Easy
18.
The function test(value) has a try that does 10 // value, an except for ZeroDivisionError, an else…
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Hard
19.
The list ["4", "x", "7", "3"] holds texts.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Hard
20.
Write average(numbers) that returns the average, or the message there are no numbers for an empty…
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
21.
Ask for an age until it is a whole number from 0 to 120.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Hard
22.
Write a program that asks for a whole number again and again until the user types one.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
23.
For marks = {"Asha": 72, "Ravi": 85}, show the mark of Asha and of Kabir with try and except.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Easy
24.
Write a function item_at(items, position) that returns the item, or no item at that position.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
25.
Write a function divide(a, b) that gives the answer, or the message cannot divide by zero.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsStemPy LabStemPy Lab
Medium
Page 1 of 2

Showing 1–25 of 27