orders is the list of the lines of a shop bill. Each line is a tuple (item, price, quantity): the name of the item, the price of one piece in rupees and the number of pieces bought. The price and the quantity are integers, 0 or more.
Write a function bill_total(orders) that returns the total amount of the bill: for each line multiply the price by the quantity, and add the results of all the lines. If orders is empty, return 0.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
bill_total([("pen", 10, 3), ("notebook", 45, 2)]) -> 120
bill_total([("eraser", 5, 1)]) -> 5
Implement this function:
def bill_total(orders: list) -> int:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: orders.
Input
[("pen", 10, 3), ("notebook", 45, 2)]
Output
120

`orders` is the list of the lines of a shop bill. Each line is a tuple `(item, price, quantity)`: the name of the item, the price of one piece in rupees and the number of pieces bought. The price and the quantity are integers, 0 or more. Write a function `bill_total(orders)` that returns the total amount of the bill: for each line multiply the price by the quantity, and add the results of all the lines. If `orders` is empty, return 0. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` bill_total([("pen", 10, 3), ("notebook", 45, 2)]) -> 120 bill_total([("eraser", 5, 1)]) -> 5 ``` ## Your task Implement this function: ```python def bill_total(orders: list) -> int: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `orders`. ## Example **Input** ``` [("pen", 10, 3), ("notebook", 45, 2)] ``` **Output** ``` 120 ``` `students` is a list of dictionaries. Each dictionary is one student and has two keys: `"name"` (the name of the student) and `"marks"` (an integer). A student has passed if the marks are greater than or equal to `pass_mark`. Write a function `passed_students(students, pass_mark)` that returns the list of the names of the students who passed, in the same order as they are in `students`. If no student passed, return an empty list. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` passed_students([{"name": "Asha", "marks": 72}, {"name": "Bala", "marks": 35}, {"name": "Chitra", "marks": 40}], 40) -> ['Asha', 'Chitra'] passed_students([{"name": "Dev", "marks": 20}], 50) -> [] ``` ## Your task Implement this function: ```python def passed_students(students: list, pass_mark: int) -> list: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `students`, `pass_mark`. ## Example **Input** ``` [{"name": "Asha", "marks": 72}, {"name": "Bala", "marks": 35}, {"name": "Chitra", "marks": 40}] 40 ``` **Output** ``` ['Asha', 'Chitra'] ``` `innings` is a list of tuples `(player, runs)`: the name of a batter and the runs that batter scored in a cricket match. The runs are integers, 0 or more. Write a function `average_runs(innings)` that returns the average of the runs of all the batters: the total of the runs divided by the number of batters. If `innings` is empty, return 0. Do not round the answer yourself. It is checked up to 4 decimal places, and a whole number is shown without a decimal point. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` average_runs([("Rohit", 40), ("Virat", 75), ("Gill", 20)]) -> 45 average_runs([("Rohit", 10), ("Virat", 5)]) -> 7.5 ``` ## Your task Implement this function: ```python def average_runs(innings: list) -> float: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `innings`. ## Example **Input** ``` [("Rohit", 40), ("Virat", 75), ("Gill", 20)] ``` **Output** ``` 45 ```