What will be the output of the following code snippet? If the output is an error, state “ERROR” in the prompt. def hype(y): if y > 10: return 2 else: return 2 + hype(y + 3)result = hype(3) # this is hype ⸜(*ˊᗜˋ*)⸝print(result)
Blog
Write a function filter_nums(num_list, threshold, divisor) t…
Write a function filter_nums(num_list, threshold, divisor) that takes a list of integers (num_list) an integer (threshold) and an integer (divisor) and filters the num_list to include only the integers that satisfy the following condition: A number n is included if n > threshold and n mod divisor = 0 (i.e. n is greater than the threshold and is divisible by divisor). The function should print (NOT RETURN) the following: Filtered number list Sum of removed numbers Count of numbers in the filtered numbers list Count of numbers in the removed numbers list Note: The divisor should have a default parameter of 2. Example: Case 1: filter_nums([1, 5, 10, 3, 9, 15, 18, 2], 4, 3) prints: Filtered Numbers: [9, 15, 18] Sum of removed numbers: 21 Count of filtered numbers: 3 Count of removed numbers: 5 Case 2: filter_nums([12, 15, 22, 27, 30, 33, 45, 5, 6], 10, 5) prints: Filtered Numbers: [15, 30, 45] Sum of removed numbers: 105 Count of filtered numbers: 3 Count of removed numbers: 6
What will be the output of the following code snippet If the…
What will be the output of the following code snippet If the output is an error, state “ERROR” in the prompt. You understand? ٩(•̤̀ᵕ•̤́๑)ᵒᵏᵎᵎᵎᵎ my_dict = { ‘person1’: {‘name’: ‘Newman’, ‘age’: 20}, ‘person2’: {‘name’: ‘Karen’, ‘age’: 21}, ‘person3’: {‘name’: ‘Ryan’, ‘age’: 19} } print(my_dict[‘person2’][‘name’])
Do you really wish to submit your exam?
Do you really wish to submit your exam?
Write a function transform_list(nums) that takes a non-empty…
Write a function transform_list(nums) that takes a non-empty list of integers as its parameter. It should recursively loop through the numbers in nums, and create a new list based on the following rules: If the number is a multiple of 3, it is added to the list three times. If the number is odd, it is not included in the new list. Any other number is decreased by 2 and added to the list once. Example: transform_list([1, 2, 3, 4, 5, 6, 7, 8, 9]) returns [0, 3, 3, 3, 2, 6, 6, 6, 6, 9, 9, 9] Note: This problem must be solved using recursion. You cannot use ‘for’ or ‘while’ loops or use list comprehension.
What will be the output of the following code snippet? If th…
What will be the output of the following code snippet? If the output is an error, state “ERROR” in the prompt. bin(num) – returns binary representation of num with ‘0b’ prefix hex(num) – returns hexadecimal representation of num with ‘0x’ prefix def number_representations(num): # (∩`-´)⊃━☆゚.*・。゚ return [num, bin(num), hex(num)]result = number_representations(21)print(result)
Convert the octal (base-8) value 234 to its decimal equivale…
Convert the octal (base-8) value 234 to its decimal equivalent. ๑(◕‿◕)๑
Tito’s Tacos is considering opening a new location in a town…
Tito’s Tacos is considering opening a new location in a town where it currently has one other location. The sales at the other location are $770,000 annually. The new location is expected to generate sales of $650,000 in the first year with 6% sales growth per year for the next 5 years. Cost of goods sold are expected to be 33% of sales. The new location will be built on land costing $125,000 and construction costs for the building will be $205,000. Assume that Tito’s requires an initial inventory of $17,875 and cash on hand of $1,850. Tito’s will also have to pay $500 for necessary licenses and permits before being allowed to open. What is the expected cash outflow in Year 0 (aka the initial outlays) for the new location?
Adding debt to the capital structure will cause Net Income t…
Adding debt to the capital structure will cause Net Income to fall by the amount of the interest expense.
If the Treasury yield curve is downward sloping then:
If the Treasury yield curve is downward sloping then: