To determine the output of the provided code, let's analyze it step by step.
The code includes a function discount_on_voucher(voucher, amount)
that calculates a discount based on the given voucher type and amount. The possible vouchers and their corresponding discount percentages are:
- 'Flat 50' gives a discount of 50% (0.5 * amount)
- 'Flat 30' gives a discount of 30% (0.3 * amount)
- 'Flat 20' gives a discount of 20% (0.2 * amount)
If the voucher does not match any of these options, the discount remains zero.
In the provided code, the following line executes the function with an invalid voucher:
disc = discount_on_voucher('Flat 75', 1000)
Since 'Flat 75' does not match any of the defined cases in the function, the discount
variable stays initialized at 0.
The return value from the function will be 0. Consequently, the printed output will be:
print(f'Discount is {disc}')
This will result in:
Discount is 0.
Thus, the correct response is:
The output will be "Discount is 0."