Use the code to answer the question.

def discount_on_weekdays(day, amount):

discount = 0

if day == 'Monday':
discount = 0.1 * amount
elif day == 'Tuesday':
discount = 0.2 * amount
elif day == 'Wednesday':
discount = 0.3 * amount
elif day == 'Thursday':
discount = 0.5 * amount
elif day == 'Friday':
discount = 0.6 * amount

return discount

disc = discount_on_weekdays('Friday', 3000)
print(f'Discount is {disc}')
What will be the output of the code? Execute your code using the Trinket.

Trinket

(1 point)
Responses

The output will be “Discount is 1800.0.”
The output will be “Discount is 1800.0.”

The output will be “Discount is 1200.0.”
The output will be “Discount is 1200.0.”

The output will be “Discount is 1810.0.”
The output will be “Discount is 1810.0.”

The output will be “Discount is 1900.0.”

1 answer

To determine the output of the provided code, we can analyze the discount_on_weekdays function. The function takes a day and an amount as arguments, then calculates the discount based on the specified day:

  • For 'Monday', a 10% discount is applied.
  • For 'Tuesday', a 20% discount is applied.
  • For 'Wednesday', a 30% discount is applied.
  • For 'Thursday', a 50% discount is applied.
  • For 'Friday', a 60% discount is applied.

In the code, the function is called with the arguments 'Friday' and 3000.

Calculating the discount for Friday:

  • Discount = 0.6 * 3000 = 1800.0

Therefore, when the line print(f'Discount is {disc}') is executed, it will print:

Discount is 1800.0.

The correct response is: The output will be “Discount is 1800.0.”