Skip to content

Commit

Permalink
Fix code style issues with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed May 28, 2022
1 parent 4f5fd96 commit 509dade
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion 1_beginner/chapter3/examples/math_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
# Exponent
x = 2
y = 3
print(x ** y) # prints 8
print(x**y) # prints 8
2 changes: 1 addition & 1 deletion 1_beginner/chapter3/solutions/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
radius = float(input("Enter a radius: "))

# Calculate the area and circumference
area = PI * radius ** 2
area = PI * radius**2
circumference = 2 * PI * radius

# Print the result
Expand Down
2 changes: 1 addition & 1 deletion 1_beginner/chapter3/solutions/cylinder_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
PI = 3.14
height = float(input("Height of cylinder: "))
radius = float(input("Radius of cylinder: "))
volume = PI * radius ** 2 * height
volume = PI * radius**2 * height
print("The volume of the cylinder is", volume)
2 changes: 1 addition & 1 deletion 1_beginner/chapter4/solutions/square.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

if number % 2 == 0:
# if number is even, print its square
print(number ** 2)
print(number**2)
else:
# otherwise, print the number itself
print(number)
4 changes: 2 additions & 2 deletions 2_intermediate/chapter13/examples/vector2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __str__(self):
"""

def __pow__(self, power):
return Vector([i ** power for i in self.vals])
return Vector([i**power for i in self.vals])

"""
Addition: adds each element to corresponding element in other vector
Expand Down Expand Up @@ -53,7 +53,7 @@ def __sub__(self, vec):
vec = Vector([2, 3, 2])
otherVec = Vector([3, 4, 5])
print(str(vec)) # [2, 3, 2]
print(vec ** 2) # [4, 9, 4]
print(vec**2) # [4, 9, 4]
print(vec - otherVec) # [-1, -1, -3]
print(vec + otherVec) # [5, 7, 7]
print(vec * 5) # [10, 15, 10]
4 changes: 2 additions & 2 deletions 2_intermediate/chapter13/examples/vector3.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def __str__(self):
return str(self.vals)

def __pow__(self, power):
return Vector([i ** power for i in self.vals])
return Vector([i**power for i in self.vals])

# Calculates Euclidean norm
def norm(self):
return sum((self ** 2).vals) ** 0.5
return sum((self**2).vals) ** 0.5

# __lt__: implements the less than operator (<)
def __lt__(self, other):
Expand Down
2 changes: 1 addition & 1 deletion 3_advanced/chapter14/solutions/odd_squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
ex_list[idx] = int(ex_list[idx])

# write your code below
odds_quares = [n ** 2 for n in list if n % 2 == 1]
odds_quares = [n**2 for n in list if n % 2 == 1]
2 changes: 1 addition & 1 deletion games/chapter4/examples/OOP_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def check_events(self, event):
mouse_pos = pygame.mouse.get_pos()
h = mouse_pos[1] - bul.rect.center[1]
w = mouse_pos[0] - bul.rect.center[0]
hyp = math.sqrt(h ** 2 + w ** 2)
hyp = math.sqrt(h**2 + w**2)
vertical_speed = (
BULLETSPEED[1] * (h / hyp) if hyp != 0 else BULLETSPEED[1] * h
)
Expand Down
2 changes: 1 addition & 1 deletion games/chapter5/practice/sound_tanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def check_events(self, event):
mouse_pos = pygame.mouse.get_pos()
h = mouse_pos[1] - bul.rect.center[1]
w = mouse_pos[0] - bul.rect.center[0]
hyp = math.sqrt(h ** 2 + w ** 2)
hyp = math.sqrt(h**2 + w**2)
vertical_speed = (
BULLETSPEED[1] * (h / hyp) if hyp != 0 else BULLETSPEED[1] * h
)
Expand Down
2 changes: 1 addition & 1 deletion games/chapter5/solutions/sound_tanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def check_events(self, event):
mouse_pos = pygame.mouse.get_pos()
h = mouse_pos[1] - bul.rect.center[1]
w = mouse_pos[0] - bul.rect.center[0]
hyp = math.sqrt(h ** 2 + w ** 2)
hyp = math.sqrt(h**2 + w**2)
vertical_speed = (
BULLETSPEED[1] * (h / hyp) if hyp != 0 else BULLETSPEED[1] * h
)
Expand Down

0 comments on commit 509dade

Please sign in to comment.