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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy