Skip to content

Commit aa63862

Browse files
meatball133BethanyG
authored andcommitted
Fixes
1 parent a170b49 commit aa63862

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

exercises/concept/electric-bill/.docs/hints.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@
22

33
Remember that you can always reuse/call previously completed functions when writing new ones.
44

5-
65
## 1. Get extra hours
6+
77
- This is all about calculating the _remainder_ left after whole division.
88
- Take a look at [`divmod()`][divmod], and look for an operator that does something similar.
99

10-
## 2. Get kW value
10+
## 2. Get kW value
11+
1112
- Remember to give [`round()`][round] a number of _decimal places_, or you will get a whole number back as a result.
1213

13-
## 3. Get kwh value
14+
## 3. Get kwh value
15+
1416
- The result of dividing an `int` by a `float` is always a `float`.
1517
- To get only an integer value from division, use [_floor_ division][floor], which will truncate the decimal.
1618

1719
## 4. Get efficiency
20+
1821
- The result of dividing an `int` by a `float` is always a `float`.
1922

20-
## 5. Get cost
23+
## 5. Get cost
24+
2125
- It might be good to _reuse_ or call other functions you have already completed here.
2226
- The result of dividing an `int` by a `float` is always a `float`.
2327

24-
2528
[divmod]: https://docs.python.org/3/library/functions.html#divmod
26-
[floor]: https://docs.python.org/3/glossary.html#term-floor-division
27-
[round]: https://docs.python.org/3/library/functions.html#round
29+
[floor]: https://docs.python.org/3/glossary.html#term-floor-division
30+
[round]: https://docs.python.org/3/library/functions.html#round

exercises/concept/electric-bill/.docs/instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The function should then `return` the watts as kilowatts rounded to 1 decimal pl
3434
1.2
3535
```
3636

37-
3. Get kwh value
37+
3. Get kWh value
3838

3939
To be able to calculate the cost of running the electronics, your employer needs to know the power usage in kWh.
4040
kWh stands for kilowatt-hour, where hour is a unit of time.
@@ -44,7 +44,7 @@ One hour is equal to 3600 seconds.
4444
To calculate the kWh value, you must convert watts to kW, and then floor-divide the result by 3600.
4545

4646
Implement a function `get_kWh_value()` that accepts an integer which holds the number of watts.
47-
The function should then `return` the watts as an integer.
47+
The function should then `return` the kilowatt-hours as an integer.
4848

4949
```python
5050
>>> get_kWh_value(5000000)
@@ -71,7 +71,7 @@ Your employer wants to know the cost of running the electronics.
7171
The cost of running the electronics is the power used multiplied by the cost per kWh.
7272
The power used is the power given divided by the calculated efficiency.
7373

74-
Implement a function `get_cost(<watts>,<power_factor>,<price>)` that accepts an integer that holds the number of watts, a float that has the power factor, and a float that holds the cost per kwh.
74+
Implement a function `get_cost(<watts>,<power_factor>,<price>)` that accepts an integer that holds the number of watts, a float that has the power factor, and a float that holds the cost per kWh.
7575
The function should then `return` the cost of running the electronics as a float.
7676

7777
```python

exercises/concept/electric-bill/.docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The modulo operator (`%`) returns the remainder of the division of the two opera
8888
>>> 8 % 2
8989
0
9090

91-
# The result of % is 2 here, because 3 only goes into 5 once, with 2 left over
91+
# The result of % is 2 here, because 3 only goes into 5 once, with 2 leftover
9292
>>> 5 % 3
9393
2
9494
```

exercises/concept/electric-bill/electric_bill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Functions which helps company to calculate their power usage"""
1+
"""Functions to help the company calculate their power usage."""
22

33

44
def get_extra_hours(hours):

exercises/concept/electric-bill/electric_bill_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_get_extra_hours(self):
2323
def test_get_kW_value(self):
2424
input_data = [1000, 2200, 2900, 900, 1160]
2525
output_data = [1, 2.2, 2.9, 0.9, 1.2]
26+
2627
for variant, (input_data, output_data) in enumerate(zip(input_data, output_data), start=1):
2728
with self.subTest(f'variation #{variant}', input_data=input_data, output_data=output_data):
2829
error_msg=f'Expected: {output_data} but got a different value.'
@@ -32,6 +33,7 @@ def test_get_kW_value(self):
3233
def test_get_kwh_value(self):
3334
input_data = (5000000, 2141241, 43252135, 5324623462, 4321512)
3435
output_data = [1, 0, 12, 1479, 1]
36+
3537
for variant, (input_data, output_data) in enumerate(zip(input_data, output_data), start=1):
3638
with self.subTest(f'variation #{variant}', input_data=input_data, output_data=output_data):
3739
error_msg=f'Expected: {output_data} but got a different value.'
@@ -51,7 +53,7 @@ def test_get_efficiency(self):
5153
def test_get_cost(self):
5254
input_data = ((5000000, 80.0, 0.25), (2141241, 99.99, 2), (43252135, 0.8, 4), (4321512, 40.0, 2))
5355
output_data = (0.3125, 0, 6000, 5)
54-
56+
5557
for variant, (input_data, output_data) in enumerate(zip(input_data, output_data), start=1):
5658
with self.subTest(f'variation #{variant}', input_data=input_data, output_data=output_data):
5759
error_msg=f'Expected: {output_data} but got a different value.'

0 commit comments

Comments
 (0)