Skip to content

Commit 2ef68a3

Browse files
committed
Fix multiplication error in double function and update formatting in format_pence_as_string function
1 parent 21a8176 commit 2ef68a3

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎Sprint5/exercise2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ def double(number):
77
# Since the function is called double, it should multiply the number by 2.
88

99
def double(number):
10-
return number * 2
10+
return number * 2
1111

1212
print(double(10))

‎Sprint5/exercise3.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def format_pence_as_string(total_pence: int) -> str:
1414
if total_pence < 100:
1515
return f"{total_pence}p"
1616

17-
pounds = int(total_pence / 100)
17+
pounds = (total_pence // 100)
1818
pence = total_pence % 100
1919

2020
return f"£{pounds}.{pence:02d}"

‎Sprint5/exercise4.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def __init__(
1010
self.age = age
1111
self.preferred_operating_system = preferred_operating_system
1212
self.address = address
13-
14-
imran = Person("Imran", 22, "Ubuntu", "Sheffield")
13+
14+
imran = Person("Imran",22,"Ubuntu","Sheffield")
1515
print(imran.address)
1616

1717
#mypy knows what attributes a Person object is supposed to have. If you try to access an attribute that isn't defined in the class, mypy can warn you before you run the program.Adress needed to define in person object for print.

0 commit comments

Comments
 (0)