8000 Update 9b-challenge-simulate-an-election.py · Democes/python-basics-exercises@b8fda62 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8fda62

Browse files
authored
Update 9b-challenge-simulate-an-election.py
1 parent 319dbb1 commit b8fda62

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ch08-conditional-logic/9b-challenge-simulate-an-election.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def run_election(regional_chances):
3737
# "B" is the total number of regions minus the number of regions won by
3838
# candidate "A". The total number of regions is the same as the length
3939
# of the regional_chances list.
40-
if num_regions_won_by_A > len(regional_chances) - num_regions_won_by_A:
40+
num_regions_won_by_B = len(regional_chances) - num_regions_won_by_A
41+
if num_regions_won_by_A > num_regions_won_by_B:
4142
return "A"
4243
else:
4344
return "B"

0 commit comments

Comments
 (0)
0