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. /PCEP (Python Institute)

PCEP (Python Institute) problems

203 problems for PCEP (Python Institute) practice, in Python Programming, each with a worked solution. Try each one on paper first, then check your answer.

Other examsJEE MainNEETBITSATWBJEEBoard ExamOlympiadSATAPA-LevelIBGaokaoPCAP (Python Institute)

Pick a subject to see its topics.

197 problems
Type:
1.
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 DebuggingBoard Exam, AP, A-Level, IB, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
2.
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 ProcessingBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
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 ProcessingBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
4.
Write a recursive function all_positive(items) that gives True if every item of the list is more…
High School (9–10), High School (11–12), Undergraduate, General · RecursionA-Level, IB, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
5.
For sum_to(3), where sum_to(n) is 0 for n == 0 and n + sum_to(n - 1) otherwise, write the calls…
High School (9–10), High School (11–12), Undergraduate, General · RecursionA-Level, IB, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
6.
What do show_up(3) and show_down(3) print? Say it before you run it.
High School (9–10), High School (11–12), Undergraduate, General · RecursionA-Level, IB, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
7.
The marks, already sorted from the highest, are [95, 90, 90, 90, 80, 75, 75].
High School (9–10), High School (11–12), Undergraduate, General · Searching and SortingBoard Exam, AP, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
8.
Write a function first_above(items, limit) that gives the position of the first item that is more…
High School (9–10), High School (11–12), Undergraduate, General · Searching and SortingBoard Exam, AP, A-Level, IB, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
9.
Say which error each line gives, before you run it.
High School (9–10), High School (11–12), Undergraduate, General · Errors and ExceptionsBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
10.
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 ExceptionsBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
11.
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 ExceptionsBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
12.
Write a program that swaps the values of two variables a and b in one line, without a third…
High School (9–10), High School (11–12), Undergraduate, General · Tuples and SetsBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
13.
Group these words by their length, in a dictionary where the key is the length and the value is the…
High School (9–10), High School (11–12), Undergraduate, General · DictionariesBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
14.
For this dictionary, write the expression for each answer.
High School (9–10), High School (11–12), Undergraduate, General · DictionariesBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Medium
15.
Write a program that counts how many times each letter appears in the word mississippi, and shows…
High School (9–10), High School (11–12), Undergraduate, General · DictionariesBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
16.
Say whether a list or a dictionary is the better choice for each, and why.
High School (9–10), High School (11–12), Undergraduate, General · DictionariesBoard Exam, PCEP (Python Institute)StemPy LabStemPy Lab
Easy
17.
This program should show the average of the even numbers in the list.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Mini ProjectsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
18.
The marks are [72, 85, 64, 90, 58, 91, 60, 74].
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Mini ProjectsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
19.
A quiz has 5 questions but only 4 answers.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Mini ProjectsPCEP (Python Institute)StemPy LabStemPy Lab
Easy
20.
The secret number is 42, the limit is 7 tries, and the player types 50, 30, 36, 42.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Mini ProjectsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
21.
Same name, two variables
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
22.
This program should show The total is 50. It stops with an error. Find the fault and fix it.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
23.
Which of these four programs shows something? Say it before you run each one.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsPCEP (Python Institute)StemPy LabStemPy Lab
Easy
24.
Here is a table of marks: one row for each student, and one column for each test.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · ListsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
25.
What do a and b show at the end? Say it before you run it.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · ListsPCEP (Python Institute)StemPy LabStemPy Lab
Medium
Page 1 of 8
…

Showing 1–25 of 197