République Algérienne Démocratique et Populaire
Ministère de l’Enseignement Supérieur et de la Recherche Scientifique
Basic Programming Concepts in Python
Basic Programming Concepts in Python Practical Sheet
Exercise 1: Write a program that takes two numbers as input and prints their
sum.
Exercise 2: Write a program that calculates the area of a rectangle given its
length and width.
Exercise 3: Write a program to calculate simple interest for a given time. The
program should take the principal amount, rate of interest, and time as input.
Exercise 4: Write a program that takes two numbers as input and prints the
largest number.
Exercise 5: Write a program that checks if a number is positive, negative, or zero.
Exercise 6: Write a program to calculate the factorial of a number.
Exercise 7: Write a program to print the multiplication table of a given number.
Exercise 8: Write a program to count the number of digits in a given number.
Exercise 9: Write a program to check if a given string is a palindrome.
Exercise 10: Write a program to find the largest element in a list.
Exercise 11: Write a program to count how many times an element appears in a
list.
Exercise 12: Write a program to remove duplicate items from a list.
Exercise 13: Write a Python function that takes two 2D lists (matrices) as input
and returns their sum. Assume the matrices have the same dimensions.
Exercise 14: Write a program to create a dictionary containing names and their
corresponding ages.
Exercise 15: Write a program to access and print the age of a specific person
from the dictionary created in the previous exercise.
Exercise 16: Write a program to add a new person and their age to the
dictionary.
Exercise 17: Write a Python function that takes a string as input and returns the
reversed string.
Exercise 18: Write a Python function that takes two lists as input and returns a
new list containing only the elements that are common to both lists.
Exercise 19: Write a Python function to generate the Fibonacci sequence up to n
terms.
Exercise 23: Write a Python function to find the greatest common divisor of two
integers.
Exercise 24: Write a Python function to check if two strings are anagrams of each
other (contain the same characters, but possibly in a different order).
[Link] Academic Year 2025/2026
République Algérienne Démocratique et Populaire
Ministère de l’Enseignement Supérieur et de la Recherche Scientifique
Basic Programming Concepts in Python
Exercise 25: Create a simple calculator program that can perform addition,
subtraction, multiplication, and division. The program should take two numbers
and an operator as input and return the result.
[Link] Academic Year 2025/2026