Skip to content

Commit fa51f76

Browse files
committed
file formating according to PEP8 throught the repo
1 parent 2aaf73d commit fa51f76

20 files changed

+65
-64
lines changed

Algorithms/Search Algorithms/binary_search.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
def binary_sort(sorted_list, length, key):
55
start = 0
6-
end = length-1
6+
end = length - 1
77
while start <= end:
8-
mid = int((start + end)/2)
8+
mid = int((start + end) / 2)
99
if key == sorted_list[mid]:
1010
print("\nEntered number %d is present "
1111
"at position: %d" % (key, mid))
@@ -17,6 +17,7 @@ def binary_sort(sorted_list, length, key):
1717
print("\nElement not found!")
1818
return -1
1919

20+
2021
lst = []
2122

2223
size = int(input("Enter size of list: \t"))

area_of_triangle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
s = (a + b + c) / 2
88

9-
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
9+
area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
1010
print('The area of the triangle is %0.2f' % area)

arithmeticOperations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
num1 = int(input('Enter First number: '))
44
num2 = int(input('Enter Second number '))
5+
56
add = num1 + num2
67
dif = num1 - num2
78
mul = num1 * num2
89
div = num1 / num2
910
floor_div = num1 // num2
1011
power = num1 ** num2
1112
modulus = num1 % num2
13+
1214
print('Sum of ', num1, 'and', num2, 'is :', add)
1315
print('Difference of ', num1, 'and', num2, 'is :', dif)
1416
print('Product of ', num1, 'and', num2, 'is :', mul)
1517
print('Division of ', num1, 'and', num2, 'is :', div)
1618
print('Floor Division of ', num1, 'and', num2, 'is :', floor_div)
1719
print('Exponent of ', num1, 'and', num2, 'is :', power)
1820
print('Modulus of ', num1, 'and', num2, 'is :', modulus)
19-

armstrong.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
if int(input_num) == arm_num:
1414
print(input_num, 'is an ARMSTRONG number')
1515
else:
16-
print(input_num, 'is NOT an armstrong number')
16+
print(input_num, 'is NOT an armstrong number')
1717

1818
except ValueError:
1919
print("That's not a valid number, Try Again !")

average.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
numbers = float(input('Enter number : '))
88
total_sum += numbers
99

10-
avg = total_sum/num
10+
avg = total_sum / num
1111
print('Average of ', num, ' numbers is :', avg)

biggest_smallest_3numbers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ def smallest(num1, num2, num3):
2424
smallest_num = num3
2525
print("The smallest of the 3 numbers is : ", smallest_num)
2626

27+
2728
largest(number1, number2, number3)
2829
smallest(number1, number2, number3)

dictionaryOperations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'Gender': 'Male',
88
'Location': 'India',
99
'Website': 'programminginpython.com'
10-
}
10+
}
1111

1212
# print dictionary
1313
print(my_info)

digits_in_number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
while input_num > 0:
77
count += 1
88
input_num //= 10
9-
print("The number of digits in the given number are:", count)
9+
print("The number of digits in the given number are:", count)

even_odd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
if input_num % 2 == 0:
66
print(input_num, "is EVEN")
77
else:
8-
print(input_num, "is ODD")
8+
print(input_num, "is ODD")

even_odd_lists.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
numbers = []
44
n = int(input("Enter number of elements: \t"))
55

6-
for i in range(1, 1+n):
6+
for i in range(1, 1 + n):
77
allElements = int(input("Enter element: \t"))
88
numbers.append(allElements)
99

@@ -18,4 +18,3 @@
1818

1919
print("Even numbers list \t", even_lst)
2020
print("Odd numbers list \t", odd_lst)
21-

0 commit comments

Comments
 (0)