1. Write a program to print electricity bill based on the consumption. • Consumption less than 200 units = No of units * 5 • Consumption between 200 and 500 = No of units * 10 • Consumption more than 500 = No of units*15 in python
Answers
Answered by
17
Code:
Explanation:
The input is retrieved using the function, which is designed for the same, in a float datatype [decimals] and is stored in the variable u. The number of units is checked using conditional statements, which are used to check for a given condition and proceed accordingly. If a condition is fulfilled, the succeeding statement is then interpreted and the final amount is printed.
Answered by
14
units = int(input())
if units < 200:
print(units * 5)
elif units > 200 and units < 500:
print(units * 10)
else:
print(units * 15)
-------------------------------
- Variable x contains the input.
- We checked the number of units according to given conditions and designed a if...elif...else framework
- And we finished it.
-------------------------------
Note :- Only enter numbers as units in the input.
-------------------------------
215
>>> 2150
125
>>> 625
532
>>> 7980
_____________________
Hope it helps...
_____________________
Similar questions