Light Bulb Energy Rating Calculator

Replacing a light bulb may not be as straight forward as it used to be. Nowadays there are many different types of light bulbs to choose from, including incandescent bulbs, halogen bulbs, fluorescent bulbs and so many different types of LED lights.

There are many criteria to consider when selecting a light bulb including:

  • The amount of light (aka luminous flux) the bulb provides, expressed in lumens (lm)
  • The power consumption over 1000 hours expressed in kW/1000h
  • The energy rating of the light bulb given as a rating between A and G

Energy Rating Ratio

The energy rating (aka Energy Efficiency class) of a light bulb is used to give an indication of how efficient / eco-friendly a light bulb is.

To workout the energy rating of a light bulb, we first need to calculate its lumens to watt efficiency ratio based on the following formula:

We can then use this ratio to determine the energy rating of the bulb using the following table:

Energy Rating Efficiency Ratio
210 or above
185 or above
160 or above
135 or above
110 or above
85 or above
Below 85

Python Challenge

Your task consists of writing a Python program that asks the user to enter two values:

  • The light output (luminous flux) of a light bulb (in lumens, lm)
  • The power consumption of the light bulb over 1000h (in kW/1000h)

Your program should then calculate the efficiency ratio of the light bulb to then output its energy rating as a label from A to G.

Python Code

You should complete your code below:

Test Plan

Once your code is complete, make sure it is working as expected by completing the following test plan:

Test # Input Values Expected Output Actual Output
#1 Light Output: 1600lm
Power Consumption: 8kW/1000h
Energy Rating: B
#2 Light Output: 1800lm
Power Consumption: 5kW/1000h
Energy Rating: A
#3 Light Output: 840lm
Power Consumption: 4kW/1000h
Energy Rating: A
#4 Light Output: 1100lm
Power Consumption: 12kW/1000h
Energy Rating: F


The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 47

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!