Print battery charge

Created by Antoine Angot

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 int between 0 and 100 as paramater, display a Bar to represent how much the battery is “filled” (from 0 to 10 bars), and prints the remaining percentage.


  • battery_charge(40) must print this output:
[❚❚❚❚      ]
  • battery_charge(42) must print this output:
[❚❚❚❚      ]
  • battery_charge(58) must print this output:
[❚❚❚❚❚❚    ]

If the ❚ character causes you problems in your editor or terminal, feel free to use a simple | instead.


  • The round builtin function.