This function should put a student into a group. If no group is given, it should start a new, empty group. But it has the mutable default bug: run it and you will see Abel appear in Selam’s group. Fix …
Define make_greeting(name, greeting=”Selam”) that returns a string in this form: Selam, Abel! The greeting comes first, then a comma and a space, then the name and an exclamation mark. If no greeting is given, the default “Selam” is used. Print …
Define mark_summary(marks) that takes a list of marks and returns three values: the lowest mark, the highest mark, and the average rounded to 1 decimal place. Then unpack the result into low, high and avg for the marks [70, 85, …
Define a function total_price(price, quantity) that returns (not prints) the price multiplied by the quantity. Then print the result of total_price(25, 3) — 3 notebooks at 25 Nakfa each. Expected output: 75
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 …
