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 Basics
  3. /Functions

Functions

Python Programming
+ Upload a Problem
More in Python BasicsGetting Started with PythonVariables and Data TypesOperators and ExpressionsInput and OutputStringsConditionals: if, elif, elseLoopsListsFunctionsMini Projects
14 problems
Type:
1.
A function ticket_price(age) gives the price of a museum ticket: under 5 is free (0), under 13 pays…
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
2.
Same name, two variables
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
3.
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 · FunctionsStemPy LabStemPy Lab
Medium
4.
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 · FunctionsStemPy LabStemPy Lab
Easy
5.
Why does this program stop with a NameError? Fix it.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Hard
6.
Write a function total(items) that adds a list, and a function average(items) that uses total.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Hard
7.
Write a function power(base, exponent=2). What are power(5), power(2, 10) and power(10, 3)?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
8.
Write a function c_to_f(celsius) with F = C × 9/5 + 32. What does it return for 37, 100 and -40?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
9.
Write a function bigger(a, b) that returns the bigger of two numbers, without using max.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
10.
Write a function is_even(n) that returns True if n is even, and False if it is odd.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Medium
11.
One function shows its answer with print.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Hard
12.
Write a function area(length, width) that returns the area. What are area(5, 3) and area(12.5, 4)?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Easy
13.
Write a function greet(name) that shows Hello, followed by the name and an exclamation mark.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Easy
14.
Write a function say_hello that shows Hello!. Call it three times.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · FunctionsStemPy LabStemPy Lab
Easy