LearnPy Hub
← Inheritance & Special Methods problems
Hard

Abstract Base Class

Use abc.ABC to make Payment with an abstract method fee(amount). Bkash charges 1.85%, Card charges 2.5% plus 5, Cash charges 0. Read lines method amount until END and print each fee with 2 decimals, then the total.

Input

Lines, then END.

Output

Fees, then the total.

Sample 1

Input
bkash 1000
card 1000
cash 1000
END
Output
18.50
30.00
0.00
48.50

Sample 2

Input
card 0
END
Output
5.00
5.00
solution.py
Output appears here
Abstract Base Class · Python practice problem · LearnPy Hub