Skip to content

Commit d1cb6a4

Browse files
committed
operators function task complete
1 parent c72feb1 commit d1cb6a4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

016_operators.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,34 @@ def add_one(num):
5454

5555
# == Subtraction ==
5656

57-
# subtracted = 2 ? 3
58-
# print(f"2 ? 3 = {subtracted} (should be -1)")
57+
subtracted = 2 - 3
58+
print(f"2 - 3 = {subtracted} (should be -1)")
5959

6060
# == Division ==
6161

62-
# divided = 2 ? 3
63-
# print(f"2 ? 3 = {divided} (should be 0.6666666666666666)")
62+
divided = 2 / 3
63+
print(f"2 / 3 = {divided} (should be 0.6666666666666666)")
6464

6565
# This kind of 'decimal point' number, 0.6666666666666666 is
6666
# called a float, by the way, meaning 'floating point'.
6767

6868
# == Modulus ==
6969
# Sometimes known as "remainder if we divide 3 by 2"
7070

71-
# modulus = 3 ? 2
72-
# print(f"3 ? 2 = {modulus} (should be 1)")
71+
modulus = 3 % 2
72+
print(f"3 % 2 = {modulus} (should be 1)")
7373

7474
# == Floor division ==
7575
# Sometimes known as "division without remainder"
7676

77-
# floor_divided = 2 ? 3
78-
# print(f"2 ? 3 = {floor_divided} (should be 0)")
77+
floor_divided = 2 // 3
78+
print(f"2 // 3 = {floor_divided} (should be 0)")
7979

8080
# == Exponentiation ==
8181
# Sometimes known as "2 to the power of 3"
8282

83-
# expr = 2 ? 3
84-
# print(f"2 ? 3 = {expr} (should be 8)")
83+
expr = 2 ** 3
84+
print(f"2 ? 3 = {expr} (should be 8)")
8585

8686
# There are many more operators in Python that you can
8787
# research. You're very welcome to try out a few below:

0 commit comments

Comments
 (0)