Skip to content

Commit 42c43b7

Browse files
Merge pull request #1948 from Piombacciaio/patch-4
Updated flake8 errors
2 parents 73ff3af + 6b493d1 commit 42c43b7

14 files changed

+41
-42
lines changed

Colors/multicoloredline.py

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

66
console = Console()
77

8-
console.rule(multiclored=true)
8+
console.rule(multiclored=True)

FIND FACTORIAL OF A NUMBER.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Python program to find the factorial of a number provided by the user.
22

33
def factorial(n):
4-
if n < 0:
5-
return("Oops!Factorial Not Possible")
6-
elif n == 0:
7-
return 1
8-
else:
9-
return n*factorial(n-1)
4+
if n < 0:
5+
return "Oops!Factorial Not Possible"
6+
elif n == 0:
7+
return 1
8+
else:
9+
return n*factorial(n-1)
1010

1111
n = int(input())
1212
print(factorial(n))
13-

Grocery calculator.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
#Object = GroceryList
1010
#Methods = addToList, Total, Subtotal, returnList
11-
1211
class GroceryList(dict):
1312

14-
def __init__(self):
15-
self = {}
13+
def __init__(self):
14+
self = {}
1615

17-
def addToList(self, item, price):
18-
self.update({item:price})
16+
def addToList(self, item, price):
17+
18+
self.update({item:price})
1919

20-
def Total(self):
20+
def Total(self):
2121
total = 0
2222
for items in self:
2323
total += (self[items])*.07 + (self[items])
2424
return total
2525

26-
def Subtotal(self):
26+
def Subtotal(self):
2727
subtotal = 0
2828
for items in self:
2929
subtotal += self[items]
3030
return subtotal
3131

32-
def returnList(self):
32+
def returnList(self):
3333
return self
3434

3535
'''Test list should return:
@@ -44,12 +44,12 @@ def returnList(self):
4444
List1.addToList("kombucha", 3)
4545

4646

47-
print List1.Total()
48-
print List1.Subtotal()
49-
print List1.returnList()
47+
print(List1.Total())
48+
print(List1.Subtotal())
49+
print(List1.returnList())
5050

5151
#*****************************************************
52-
print
52+
print()
5353
#*****************************************************
5454

5555

@@ -59,6 +59,6 @@ def returnList(self):
5959
List2.addToList('wine', 25.36)
6060
List2.addToList('steak', 17.64)
6161

62-
print List2.Total()
63-
print List2.Subtotal()
64-
print List2.returnList()
62+
print(List2.Total())
63+
print(List2.Subtotal())
64+
print(List2.returnList())

Mad Libs Generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//Loop back to this point once code finishes
1+
#Loop back to this point once code finishes
22
loop = 1
33
while (loop < 10):
4-
// All the questions that the program asks the user
4+
# All the questions that the program asks the user
55
noun = input("Choose a noun: ")
66
p_noun = input("Choose a plural noun: ")
77
noun2 = input("Choose a noun: ")
88
place = input("Name a place: ")
99
adjective = input("Choose an adjective (Describing word): ")
1010
noun3 = input("Choose a noun: ")
11-
// Displays the story based on the users input
11+
# Displays the story based on the users input
1212
print ("------------------------------------------")
1313
print ("Be kind to your",noun,"- footed", p_noun)
1414
print ("For a duck may be somebody's", noun2,",")
@@ -18,5 +18,5 @@
1818
print ("You may think that is this the",noun3,",")
1919
print ("Well it is.")
2020
print ("------------------------------------------")
21-
// Loop back to "loop = 1"
21+
# Loop back to "loop = 1"
2222
loop = loop + 1

Python Program for Tower of Hanoi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Recursive Python function to solve the tower of hanoi
22
def TowerOfHanoi(n , source, destination, auxiliary):
33
if n==1:
4-
print "Move disk 1 from source",source,"to destination",destination
4+
print("Move disk 1 from source ",source," to destination ",destination)
55
return
66
TowerOfHanoi(n-1, source, auxiliary, destination)
7-
print "Move disk",n,"from source",source,"to destination",destination
7+
print("Move disk ",n," from source ",source," to destination ",destination)
88
TowerOfHanoi(n-1, auxiliary, destination, source)
99
n = 4
1010
TowerOfHanoi(n,'A','B','C')

Python Program to Count the Number of Each Vowel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
if char in count:
1717
count[char] += 1
1818

19-
print(count)s
19+
print(count)

Python Program to Reverse a linked list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def push(self, new_data):
3737
def printList(self):
3838
temp = self.head
3939
while(temp):
40-
print temp.data,
40+
print(temp.data)
4141
temp = temp.next
4242

4343

@@ -48,10 +48,10 @@ def printList(self):
4848
llist.push(15)
4949
llist.push(85)
5050

51-
print "Given Linked List"
51+
print("Given Linked List")
5252
llist.printList()
5353
llist.reverse()
54-
print "\nReversed Linked List"
54+
print("\nReversed Linked List")
5555
llist.printList()
5656

5757
# This code is contributed by Nikhil Kumar Singh(nickzuck_007)

Python-Array-Equilibrium-Index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Array Equilibrium Index
1+
"""Array Equilibrium Index
22
Send Feedback
33
Find and return the equilibrium index of an array. Equilibrium index of an array is an index i such that the sum of elements at indices less than i is equal to the sum of elements at indices greater than i.
44
Element at index i is not included in either part.
@@ -13,7 +13,7 @@
1313
7
1414
-7 1 5 2 -4 3 0
1515
Sample Output :
16-
3
16+
3 """
1717
def equilibrium(arr):
1818

1919
# finding the sum of whole array

To find the largest number between 3 numbers.py

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

33
a=[]
44
for i in range(3):
5-
a.append(int(input())
5+
a.append(int(input()))
66
print("The largest among three numbers is:",max(a))
77

addtwonumber.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Python Program to Add Two Numbers
1+
#Python Program to Add Two Numbers
22
a = int(input("enter first number: "))
33
b = int(input("enter second number: "))
44

0 commit comments

Comments
 (0)