Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8fda62

Browse files
authored
Update 9b-challenge-simulate-an-election.py
1 parent319dbb1 commitb8fda62

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-
ifnum_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+
ifnum_regions_won_by_A>num_regions_won_by_B:
4142
return"A"
4243
else:
4344
return"B"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp