Skip to content

Commit 2449ac8

Browse files
committed
pypoll main
1 parent fe2059c commit 2449ac8

File tree

3 files changed

+32
-76
lines changed

3 files changed

+32
-76
lines changed

PyBank/budget_data.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

PyBank/main.py

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

55

6-
greatest_increase = ["", 0]
7-
greatest_decrease = ["", 9999999999999999999]
6+
greatest_increase = ['', 0]
7+
greatest_decrease = ['', 9999999999999999999]
88
change_list = []
99
total_change = 0
1010
months = []
@@ -54,6 +54,13 @@
5454

5555
print(f"Average_change : {int(avg_change)}")
5656

57+
print(f"Greatest Increase in profit:{ greatest_increase('[' str(row) ']') + change_value}")
58+
59+
print(f"Greatest Decrease in profit:{ greatest_decrease('[' str(row) ']') + change_value}")
60+
61+
62+
63+
5764

5865

5966

PyPoll/main.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,35 @@
22
import csv
33

44
vote_count = 0
5-
candidate_list = []
6-
Candidate = str(row [0])
5+
candidate_names = []
6+
candidate_votes = [0,0,0,0]
7+
78

89
# Path to collect data from the Resources folder
910
budget_csv = os.path.join('.','Resources','election_data.csv')
1011
with open(budget_csv, 'r') as csvfile:
12+
1113
csvreader = csv.reader(csvfile, delimiter=',')
1214
header = next(csvreader)
13-
for row in csvreader:
14-
vote_count = vote_count+1
15-
candidate_list.append(str(Candidate)
1615

17-
for Candidate in candidate_list
18-
print(Candidate)
16+
for row in csvreader:
1917

20-
print(vote_count)
18+
vote_count +=1
19+
20+
if candidate[0] =!candidate[0+1]:
21+
candidate_names.append.[str(candidate)]
22+
print(candidate)
23+
24+
25+
26+
for candidates in candidate_names:
27+
candidate_votes +=1
28+
print(candidate_votes)
29+
next candidate
30+
vote_percentage = candidate_votes/vote_count*100
31+
print(vote_percentage)
32+
33+
print(vote_count)
2134

2235

2336
print("Election results")
@@ -28,6 +41,8 @@
2841

2942
print("---------------------------")
3043

44+
print()
45+
3146

3247

3348

0 commit comments

Comments
 (0)