Skip to content

Commit

Permalink
Merge pull request #10 from wookiemage/branch1
Browse files Browse the repository at this point in the history
Found and fixed an issue with my finding the top customer function us…
  • Loading branch information
ColinRNickels committed Apr 25, 2016
2 parents 772575f + 9925b4e commit 599d3db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fileChangers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ def averageValue(tarFile, colNum):
#This function takes a target csv file, turns it into a table (list of lists), finds the largest value in one collumn of that list, then returns the value, and two other cells on that row
def topCustomer(tarFile, colNum):
with open(tarFile) as temp:
biggestAmount = None
biggestRow = None
biggestAmount = 0
biggestRow = 0
rowNum = 0
workingFile = temp.readlines()
table = []
for line in workingFile:
table.append(line.split(","))
for row in table[1:]:
rowNum = rowNum + 1
if biggestAmount is None or row[colNum] > biggestAmount:
biggestAmount = row[colNum]
toInt = row[colNum][1:].rstrip("\n")
if (int(toInt[:-3]) > biggestAmount):
biggestAmount = int(toInt[:-3])
biggestRow = rowNum
# print(biggestAmount, biggestRow)
print("The Best Customer is: ", table[biggestRow][1],table[biggestRow][2])
print("They have paid: ", biggestAmount)
print("$" * (int(float(biggestAmount[1:])/100)))
print("$" * (int(float(biggestAmount)/100)))
print("Each '$' = 100 dollars")
print("Their IP Address indicates they are located in", IPQuery(table[biggestRow][5])[5])

Expand Down

0 comments on commit 599d3db

Please sign in to comment.