Define shop_receipt(customer, prices). customer is a name and prices is a list of prices in Nakfa. The function prints three lines: Customer: Abel Items: 3 Total: 45 Nakfa Use len() for the number of items and a for loop to …
Define a function describe_student(name, age, city) that prints one sentence in exactly this form: Selam is 16 years old and lives in Asmara. Then call it with the arguments “Selam”, 16 and “Asmara”. The checker will also call your function …
Create two functions: print_line() — prints a line of 20 equals signs (=). Use “=” * 20. print_header() — has a docstring, calls print_line(), prints Abel Bakery, Asmara, then calls print_line() again. Call print_header() once. Expected output: ==================== Abel Bakery, …
Define a function called show_welcome that prints exactly these two lines: Welcome to Keren Library Open: 8:00 – 17:00 Then call the function once at the bottom of your program. The expected output is the same two lines.
A prime number is a whole number greater than 1 that can only be divided evenly by 1 and itself (2, 3, 5, 7, 11 …). Find all prime numbers from 2 to 30 using nested for loops: Create an …
Print the multiplication table of 7 from 1 to 10 using a for loop and range(). Also create an empty list called results before the loop and append every answer to it. Expected output: 7 x 1 = 7 7 …
The secret number is 7. A player’s guesses are stored in a list (there is no input() in the editor): guesses = [3, 9, 7, 5] Use a while loop with an index to check the guesses one by one: …
Selam saves 200 Nakfa every month. She needs at least 1500 Nakfa. Use a while loop to find out how many months she needs. Start with savings = 0 and months = 0. In each round, add 200 to savings …
Each task is a tuple (a, operator, b). Loop through tasks and use match on the operator: “+”, “-“, “*”: calculate the result. “/” with a guard if b != 0: calculate a / b. “/” (when b is 0): …
Days are numbered from 1 (Monday) to 7 (Sunday). Given day = 6, use match to create a variable kind: “Weekday” for 1, 2, 3, 4 or 5 (one case with |) “Weekend” for 6 or 7 (one case with …
