Write a function named
battery_charge that graphically represents
a battery’s charge. Your function doesn't need to return anything,
but just show how much a battery is charged.
This function will takes an
100 as a
parameter, display a bar to represent how much the battery is "filled"
10 bars), then prints the percentage.
The number of bars should be rounded, meaning that both 9% and 11% are represented by one bar.
>>> battery_charge(0) [ ] 0% >>> battery_charge(5) [ ] 5% >>> battery_charge(9) [❚ ] 9% >>> battery_charge(11) [❚ ] 11% >>> battery_charge(100) [❚❚❚❚❚❚❚❚❚❚] 100%
❚ character causes you problems in your editor or terminal, feel free to
use a simple
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.