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
  • Prepare for an Exam
  • 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. /A-Level

A-Level problems

501 problems for A-Level practice, each with a worked solution. Try each one on paper first, then check your answer.

Other examsJEE MainJEE AdvancedNEETBITSATWBJEEBoard ExamOlympiadSATAPIBGaokaoPCEP (Python Institute)PCAP (Python Institute)

Choose a topic to see its subtopics.

64 problems
Type:
1.
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 DebuggingA-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Easy
2.
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 DebuggingAP, A-Level, IBStemPy LabStemPy Lab
Easy
3.
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 DebuggingAP, A-Level, IBStemPy LabStemPy Lab
Easy
4.
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 DebuggingBoard Exam, AP, A-Level, IBStemPy LabStemPy Lab
Medium
5.
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 DebuggingA-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Medium
6.
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
7.
Use a stack to write a function reverse_words(sentence) that reverses the order of the words of a…
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresBoard Exam, A-Level, IBStemPy LabStemPy Lab
Easy
8.
Customers arrive and are served one at a time, each needing some minutes: Asha 4, Ravi 2, Meera 6.
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Medium
9.
For each job, say whether a stack or a queue fits, and why.
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresBoard Exam, A-Level, IBStemPy LabStemPy Lab
Easy
10.
A chain of nodes holds 3, 1, 4, 1, 5, built as in the lesson.
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Easy
11.
A chain holds 1, 2, 3, 4. Show, by following the links, what remove(head, 1) and remove(head, 3)…
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Medium
12.
Write a function that finds the value of the middle node of a chain in one pass, without counting…
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Hard
13.
Insert the values 50, 30, 70, 20, 40, 60, 80, 30 into an empty binary search tree, in that order.
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Easy
14.
What is the height of the tree made by inserting 5, 3, 8, 1, 4, 7, 9 in that order, and of the one…
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-Level, IBStemPy LabStemPy Lab
Medium
15.
From the dictionary of friends in the lesson, write a function that gives the person with the most…
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresBoard Exam, A-Level, IBStemPy LabStemPy Lab
Easy
16.
A network has the links A to B, B to C, D to E, and F alone.
High School (11–12), High School (9–10), Undergraduate, General · Data StructuresA-LevelStemPy LabStemPy Lab
Medium
17.
A file visits.txt is made with "w", and the line Asha is written.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Easy
18.
Write a function read_number(name) that reads a file with one whole number in it, and gives the…
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Medium
19.
A file nums.txt has one number on each line: 4, 9, 2, 7.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Easy
20.
Make a file poem.txt with the three lines roses are red, violets are blue and sugar is sweet.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Medium
21.
Write a function longest_line(name) that gives the longest line of a file, without its new line.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Easy
22.
A file marks.txt holds Asha:72, Ravi:85, Meera:64, one on each line.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Medium
23.
A CSV text has the header item,price,quantity and the rows pen,10,3, book,80,1 and bag,450,2.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IBStemPy LabStemPy Lab
Medium
24.
Write a CSV file scores.csv with the header name,score and the rows Asha,72 and Rao, Ravi,85 (the…
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsBoard Exam, A-Level, IBStemPy LabStemPy Lab
Easy
25.
Write load_list(name) that gives the list that is saved in a JSON file.
High School (11–12), High School (9–10), Undergraduate, General · Files and Data FormatsA-Level, IB, PCAP (Python Institute)StemPy LabStemPy Lab
Medium
Page 1 of 3

Showing 1–25 of 64