Skip to content

Commit b8f3d7c

Browse files
author
Shehab Abdel-Salam
committed
Released 0.1.0
1 parent 29192b5 commit b8f3d7c

File tree

110 files changed

+294
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+294
-169
lines changed

CHANGELOG.md

+12

chapters/chapter02_variables/exercises/exercise_01.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_01 - Convert Hours to Seconds
1+
# Exercise 01 - Convert Hours to Seconds
22
# Write a program that converts hours to seconds.
33

44
# For example, given the number of hours 2, the function should return 7200.

chapters/chapter02_variables/exercises/exercise_02.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_02 - Temperature Conversion
1+
# Exercise 02 - Temperature Conversion
22
# Write a program that converts a temperature from Celsius to Fahrenheit.
33
# Hint: The formula is: F = C * 9/5 + 32
44

chapters/chapter02_variables/exercises/exercise_03.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_03 - Add Numbers
1+
# Exercise 03 - Add Numbers
22
# Write a program that adds two numbers (provided as strings) and returns the sum as a string.
33
# For example, given the strings "123" and "456", the function should return "579".
44
# Hint: Can built-in functions help for type conversion?

chapters/chapter02_variables/exercises/exercise_04.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_04 - Difference in Length
1+
# Exercise 04 - Difference in Length
22
# Write a program that returns the length difference between two words.
33
# For example, given the words "Python" and "Programming", the function should return 3.
44
# Note: The function should return the absolute value of the difference.

chapters/chapter02_variables/exercises/exercise_05.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_05 - Average Grade
1+
# Exercise 05 - Average Grade
22
# Write a program that takes three grades (int or float) from a user and calculate the average grade (float).
33
# The average grade should be **rounded to two decimal places**.
44

chapters/chapter02_variables/exercises/exercise_06.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_06 - Binary to Decimal
1+
# Exercise 06 - Binary to Decimal
22
# Write a program that takes a binary string as input and
33
# returns its decimal representation as an integer.
44
# For example, given the binary string "1010", the function should return 10.

chapters/chapter02_variables/exercises/exercise_07.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 02_07 - May The Force Be With You
1+
# Exercise 07 - May The Force Be With You
22
# Write a program that calculates the force of gravity between two objects.
33
# The formula to calculate the force of gravity is:
44
# F = G * (m1 * m2) / r^2

chapters/chapter03_operators/exercises/exercise_08.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_01 - Area of a Circle
1+
# Exercise 08 - Area of a Circle
22
# Write a program that computes the area of a circle given its radius.
33

44

chapters/chapter03_operators/exercises/exercise_09.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_02 - Slope of a Line
1+
# Exercise 09 - Slope of a Line
22
# Write a program that computes the slope of a line given two points.
33

44

chapters/chapter03_operators/exercises/exercise_10.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_03 - Bitwise Operations
1+
# Exercise 10 - Bitwise Operations
22
# Write a program that takes two numbers as input and performs
33
# bitwise AND, OR, and XOR operations and returns the results in a single string with a space between.
44
# For example, given the numbers 5 and 3, the function should return "1 7 6".

chapters/chapter03_operators/exercises/exercise_11.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_04 - Area of a Triangle
1+
# Exercise 11 - Area of a Triangle
22
# Write a program that calculates the area of a triangle.
33

44

chapters/chapter03_operators/exercises/exercise_12.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_05 - Pythagorean Theorem
1+
# Exercise 12 - Pythagorean Theorem
22
# Write a program that takes the lengths of two sides of a right triangle
33
# as input and returns the length of the hypotenuse using the Pythagorean theorem
44
# https://en.wikipedia.org/wiki/Pythagorean_theorem.

chapters/chapter03_operators/exercises/exercise_13.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_06 - ISBN Verifier
1+
# Exercise 13 - ISBN Verifier
22
# Write a program that checks if a given ISBN number is valid.
33
# The ISBN is valid if:
44
# - It consists of 10 digits.

chapters/chapter03_operators/exercises/exercise_14.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 03_07 - Stats Report
1+
# Exercise 14 - Stats Report
22
# Given three numbers that represent the number of wins, losses, and draws of a football team,
33
# write a program that generates a report with the following information:
44
# 1- The total number of games played.

chapters/chapter04_control_flow/exercises/exercise_15.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_01 - FizzBuzz
1+
# Exercise 15 - FizzBuzz
22
# Write a program that takes an integer as input and returns either:
33
# 1. "Fizz" if the number is divisible by 3,
44
# 2. "Buzz" if the number is divisible by 5, and

chapters/chapter04_control_flow/exercises/exercise_16.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_02 - Is Prime
1+
# Exercise 16 - Is Prime
22
# Write a program that takes an integer as input and returns True if the number is prime, False otherwise.
33
# A prime number is a number that is only divisible by 1 and itself.
44
# For example, 2, 3, 5, 7, 11, 13, and 17 are prime numbers.

chapters/chapter04_control_flow/exercises/exercise_17.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_03 - Alice and Mark
1+
# Exercise 17 - Alice and Mark
22
# Alice has scored X marks in her test and Bob has scored Y marks in the same test.
33
# Alice is happy if she scored at least twice the marks of Bob’s score.
44

chapters/chapter04_control_flow/exercises/exercise_18.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_03 - Check Number
1+
# Exercise 18 - Check Number
22
# Write a program that returns:
33
# - 'Positive' if the number is greater than 0
44
# - 'Negative' if the number is less than 0

chapters/chapter04_control_flow/exercises/exercise_19.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_04 - Even or Odd Number
1+
# Exercise 19 - Even or Odd Number
22
# Write a program that takes an integer and returns whether its an even or odd number.
33
# Bonus: can you solve this in a single line of code? (Hint: Search for ternary operator)
44

chapters/chapter04_control_flow/exercises/exercise_20.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_05 - Grade Result
1+
# Exercise 20 - Grade Result
22
# Write a program that take an integer between 0 and 100
33
# and returns the grade result based on the following rules:
44
# 1. “A” if grade is between 90 and 100

chapters/chapter04_control_flow/exercises/exercise_21.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_06 - Sum Numbers
1+
# Exercise 21 - Sum Numbers
22
# Write a program that sums the numbers from start to end.
33
# For example, if the start is 1 and the end is 5, the sum is 15 (1 + 2 + 3 + 4 + 5).
44

chapters/chapter04_control_flow/exercises/exercise_22.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_07 - Sum Even Numbers
1+
# Exercise 22 - Sum Even Numbers
22
# Write a program that sums the even numbers from start to end.
33
# For example, if the start is 1 and the end is 5, the sum is 6 (2 + 4).
44

chapters/chapter04_control_flow/exercises/exercise_23.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_08 - Largest Index
1+
# Exercise 23 - Largest Index
22
# Write a program that returns the index of the largest element in the list.
33
# For example, given the list [1, 2, 3, 4, 5], the function should return 4.
44

chapters/chapter04_control_flow/exercises/exercise_24.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_09 - Calculate Total Length
1+
# Exercise 24 - Calculate Total Length
22
# Write a program that calculates the total length of all words in a list.
33
# For example, given the list ['hello', 'world'], the total length is 10.
44

chapters/chapter04_control_flow/exercises/exercise_25.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_10 - Double Elements
1+
# Exercise 25 - Double Elements
22
# Write a program that doubles each element in a list of numbers.
33
# For example, given the list [1, 2, 3, 4, 5], the function should return [2, 4, 6, 8, 10].
44

chapters/chapter04_control_flow/exercises/exercise_26.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_11 - Find the First Divisible by 5
1+
# Exercise 26 - Find the First Divisible by 5
22
# Write a program that finds the first number in a list that is divisible by 5.
33
# If a number is found, return it and exit the loop. If no number is found, return None.
44
# For example, given [12, 5, 20, 25], the function should return 5.

chapters/chapter04_control_flow/exercises/exercise_27.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_12 - Skipping Negative Numbers
1+
# Exercise 27 - Skipping Negative Numbers
22
# Write a program that sums all positive numbers in a list, skipping any negative numbers.
33
# For example, if the list is [1, -2, 3, -4, 5], the sum is 9 (1 + 3 + 5).
44

chapters/chapter04_control_flow/exercises/exercise_28.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_14 - Reverse Digits
1+
# Exercise 28 - Reverse Digits
22
# Write a program that takes an integer as input and returns the integer with its digits reversed.
33
# For example, given the integer 123, the function should return 321.
44

chapters/chapter04_control_flow/exercises/exercise_29.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 04_15 - GPA Calculator
1+
# Exercise 29 - GPA Calculator
22
# Write a program that calculates the GPA of a student.
33
# The program should take in the grades of the courses and return the GPA of the student.
44
# For example, given the grades [4, 3, 2], the function should return 3.0.

chapters/chapter05_functions/exercises/exercise_30.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_01 - Simple Function
1+
# Exercise 30 - Simple Function
22
# Write a function that adds a number by a factor passed as an argument.
33
# The factor should have a default value of 1.
44
# For example

chapters/chapter05_functions/exercises/exercise_31.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_02 - Palindrome
1+
# Exercise 31 - Palindrome
22
# Write a function to check whether a string is palindrome or not
33

44
# A palindrome is a word that reads the same forward and backward.

chapters/chapter05_functions/exercises/exercise_32.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_03 - Factorial
1+
# Exercise 32 - Factorial
22
# Write a function that computes the factorial of a Number.
33
# Factorial is the product of an integer and all the integers below it.
44

chapters/chapter05_functions/exercises/exercise_33.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_04 - Fibonacci Sequence
1+
# Exercise 33 - Fibonacci Sequence
22
# Write a function that takes a number n and returns the nth number in the Fibonacci sequence.
33
# The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones.
44
# The first few numbers in the sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on.

chapters/chapter05_functions/exercises/exercise_34.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_05 - Multiple Vouchers
1+
# Exercise 34 - Multiple Vouchers
22
# Write a function that takes a list of vouchers and a total amount,
33
# and returns the total amount after applying each voucher to the total amount.
44

chapters/chapter05_functions/exercises/exercise_35.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_06 - Find Max
1+
# Exercise 35 - Find Max
22
# Write a function that takes any number of arguments and returns the maximum value.
33
# Hint: Consider using *args syntax to handle a variable number of arguments.
44

chapters/chapter05_functions/exercises/exercise_36.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_07 - Sum Array (Recursive)
1+
# Exercise 36 - Sum Array (Recursive)
22
# Write a recursive function that takes a string of digits and returns its sum.
33
# For example, the string "123" should return 6.
44

chapters/chapter05_functions/exercises/exercise_37.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_08 - Multiply Two Numbers
1+
# Exercise 37 - Multiply Two Numbers
22
# Write a lambda function that takes two arguments and returns their product.
33

44
# DO NOT CHANGE THE FUNCTION NAME.

chapters/chapter05_functions/exercises/exercise_38.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_09 - Count Vowels Of A String
1+
# Exercise 38 - Count Vowels Of A String
22
# Write a function that takes a string and returns the total number of vowels in the string.
33
# For example, the string "hello" should return 2.
44

chapters/chapter05_functions/exercises/exercise_39.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 05_10 - Count Character Frequency
1+
# Exercise 39 - Count Character Frequency
22
# Write a function that takes a string and a character
33
# and returns the number of times the character appears in the string.
44

chapters/chapter06_datastructures/exercises/exercise_40.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_01 - Anagrams
1+
# Exercise 40 - Anagrams
22
# Write a funtion that takes two strings and check if they are anagrams.
33
# An Anagram is a word formed by rearranging the letters of a different word, using all the original letters exactly once.
44
# For example, the words "listen" and "silent" are anagrams.

chapters/chapter06_datastructures/exercises/exercise_41.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_02 - Remove Duplicates
1+
# Exercise 41 - Remove Duplicates
22
# Write a function that takes a list of integers and returns a new list with duplicates removed.
33
# For example, the list [1, 2, 2, 3, 3, 3] should return [1, 2, 3].
44

chapters/chapter06_datastructures/exercises/exercise_42.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_03 - Count letters
1+
# Exercise 42 - Count letters
22
# Write a function that takes a string and returns a dictionary
33
# with the count of each letter in the string.
44
# For example, the string "hello" should return {'h': 1, 'e': 1, 'l': 2, 'o': 1}.

chapters/chapter06_datastructures/exercises/exercise_43.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_04 - Unique elements
1+
# Exercise 43 - Unique elements
22
# Write a function unique_elements that takes two lists and
33
# returns a set of unique elements that are in either of the two lists.
44
# For example, given the lists [1, 2, 2, 3] and [2, 1, 4],

chapters/chapter06_datastructures/exercises/exercise_44.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_05 - Sum of Frequency Tuples
1+
# Exercise 44 - Sum of Frequency Tuples
22
# Write a function that takes a list of tuples where each tuple
33
# contains a name (string) and a frequency (integer) and returns a dictionary that
44
# contains the sum of the frequencies for each name.

chapters/chapter06_datastructures/exercises/exercise_45.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_06 - Count Words
1+
# Exercise 45 - Count Words
22
# Write a function that takes a list of strings and returns a dictionary
33
# where the keys are the strings and the values are the number of occurrences of each string.
44
# For example, ["python", "c", "java", "python"] should return {"python": 2, "c": 1, "java": 1}.

chapters/chapter06_datastructures/exercises/exercise_46.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_07 - Valid Parentheses
1+
# Exercise 46 - Valid Parentheses
22
# Write a function that takes a string containing only parentheses '(', ')', '{', '}', '[' and ']'
33
# and returns True if the parentheses are valid, and False otherwise.
44
# For example, the string "([])" should return True, and the string "())" should return False.

chapters/chapter06_datastructures/exercises/exercise_47.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_08 - Record 'X's in a Matrix
1+
# Exercise 47 - Record 'X's in a Matrix
22
# Given a matrix of size n x m, write a function that returns the locations of all 'X's in the matrix.
33
# The matrix is represented as a list of lists, where each list represents a row in the matrix.
44
# Location is represented as a tuple with the row and column index.

chapters/chapter06_datastructures/exercises/exercise_48.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_09 - Spot a duplicate in a matrix
1+
# Exercise 48 - Spot a duplicate in a matrix
22
# Given matrix of size n x m and a target value, write a function that returns
33
# True if the target value is duplicated in the matrix.
44
# If there are duplicates, the function should return True, otherwise it should return False.

chapters/chapter06_datastructures/exercises/exercise_49.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 06_10 - Rolling Sum
1+
# Exercise 49 - Rolling Sum
22
# Write a function that takes a list of integers and a fixed window size N
33
# and returns the rolling sum of the list.
44
# The rolling sum is calculated by adding the elements in the window size N.

chapters/chapter07_strings/exercises/exercise_50.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_01 - Manual Substring
1+
# Exercise 50 - Manual Substring
22
# Write a function that takes a string and two indices,
33
# and returns the substring between those indices.
44
# For example, given the string "hello" and the indices 1 and 3,

chapters/chapter07_strings/exercises/exercise_51.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_02 - Reverse string
1+
# Exercise 51 - Reverse string
22
# Write a function that takes a string and returns it reversed.
33

44
# Can you do it once with slicing and once without slicing?

chapters/chapter07_strings/exercises/exercise_52.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_03 - Reverse Each Word in a Sentence
1+
# Exercise 52 - Reverse Each Word in a Sentence
22
# Write a function that takes a sentence and returns it with each word reversed.
33

44

chapters/chapter07_strings/exercises/exercise_53.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_04 - Spaces to hyphens
1+
# Exercise 53 - Spaces to hyphens
22
# Write a function replace_spaces_with_hyphens that takes a string and
33
# returns a new string with all spaces replaced by hyphens.
44
# Hint: Think about built-in string methods.

chapters/chapter07_strings/exercises/exercise_54.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_05 - Extract Error Messages
1+
# Exercise 54 - Extract Error Messages
22
# You are given a list of log entries from a server. Each entry is a string that contains:
33
# a log level, and a message, separated by spaces.
44

chapters/chapter07_strings/exercises/exercise_55.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_06 - Total Sales for Specific Products
1+
# Exercise 55 - Total Sales for Specific Products
22

33
# You are given a list of strings, each representing information about daily sales transactions.
44
# Each line contains a date, product name, and sales amount, separated by commas.

chapters/chapter07_strings/exercises/exercise_56.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_07 - Find the Longest Word
1+
# Exercise 56 - Find the Longest Word
22
# Write a function that takes a list of words and returns the longest word in the list.
33
# For example, given the list ["hello", "world", "python", "programming"],
44
# the function should return "programming".

chapters/chapter07_strings/exercises/exercise_57.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 07_08 - String Compression
1+
# Exercise 57 - String Compression
22
# Write a function that compresses a string using a simple compression algorithm.
33
# If a character appears more than once in a row, replace the sequence with
44
# the character followed by the number of times it appears.

chapters/chapter08_files/exercises/exercise_58.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_01 - Log File Analysis
1+
# Exercise 58 - Log File Analysis
22
# Write a function that reads a log file log.txt and counts the number of occurrences of the word "ERROR".
33
# Example log.txt:
44
# INFO: System started

chapters/chapter08_files/exercises/exercise_59.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_02 - File Word Frequency
1+
# Exercise 59 - File Word Frequency
22
# Write a function that reads a text file, and counts the frequency of each word,
33
# and returns a dictionary with the word as the key and the frequency as the value.
44
# For example, given the text file words.txt with the following content:

chapters/chapter08_files/exercises/exercise_60.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_03 - Course Grades Summary
1+
# Exercise 60 - Course Grades Summary
22
# Write a function that reads a file and returns the average grade for each course.
33
# Each line in the file contains the course name followed by a colon and a list of grades separated by commas.
44
# The result should be a list of tuples where the first element is the course name

chapters/chapter08_files/exercises/exercise_61.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_04 - Inventory Management System
1+
# Exercise 61 - Inventory Management System
22
# Write a CSV file containing inventory data and generates a report on stock levels and restock alerts.
33
# The CSV file contains columns: item_name, item_id, quantity, and price.
44
# Read the CSV file and calculate the total value of the inventory.

chapters/chapter08_files/exercises/exercise_62.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_05 - File Checker
1+
# Exercise 62 - File Checker
22
# Check if the numbers in the file are sorted in ascending order.
33

44
# Example: file1.txt

chapters/chapter08_files/exercises/exercise_63.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 08_06 - File Handler
1+
# Exercise 63 - File Handler
22
# Write a custom context manager using a class FileHandler that opens
33
# and closes a file. Use it to read from data.txt.
44

chapters/chapter09_error_handling/exercises/exercise_64.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exercise 09_01 - Error Handling
1+
# Exercise 64 - Error Handling
22
# Write a function that takes two numbers and returns their division.
33
# Handle the `ZeroDivisionError` exception if the second number is zero by returning `None`.
44

0 commit comments

Comments
 (0)