File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -54,34 +54,34 @@ def add_one(num):
54
54
55
55
# == Subtraction ==
56
56
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)" )
59
59
60
60
# == Division ==
61
61
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)" )
64
64
65
65
# This kind of 'decimal point' number, 0.6666666666666666 is
66
66
# called a float, by the way, meaning 'floating point'.
67
67
68
68
# == Modulus ==
69
69
# Sometimes known as "remainder if we divide 3 by 2"
70
70
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)" )
73
73
74
74
# == Floor division ==
75
75
# Sometimes known as "division without remainder"
76
76
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)" )
79
79
80
80
# == Exponentiation ==
81
81
# Sometimes known as "2 to the power of 3"
82
82
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)" )
85
85
86
86
# There are many more operators in Python that you can
87
87
# research. You're very welcome to try out a few below:
You can’t perform that action at this time.
0 commit comments