File tree 5 files changed +11
-12
lines changed
5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 4
4
import sys
5
5
import random
6
6
7
- # Number of simluations to run
7
+ # Number of simulation to run
8
8
N = 1000
9
9
10
10
11
11
def main ():
12
-
13
12
# Ensure correct usage
14
13
if len (sys .argv ) != 2 :
15
14
sys .exit ("Usage: python tournament.py FILENAME" )
@@ -61,7 +60,7 @@ def simulate_round(teams):
61
60
def simulate_tournament (teams ):
62
61
"""Simulate a tournament. Return name of winning team."""
63
62
# TODO
64
- while ( len (teams ) > 1 ) :
63
+ while len (teams ) > 1 :
65
64
teams = simulate_round (teams )
66
65
return teams [0 ]["team" ]
67
66
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ def main():
4
4
for row in range (height ):
5
5
for i in range (height - row - 1 , 0 , - 1 ):
6
6
print (" " , end = "" )
7
- for i in range (row + 1 ):
7
+ for i in range (row + 1 ):
8
8
print ("#" , end = "" )
9
9
print (" " , end = "" )
10
- for i in range (row + 1 ):
10
+ for i in range (row + 1 ):
11
11
print ("#" , end = "" )
12
12
print ()
13
13
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ def main():
15
15
s = s_cnt * 100 / w_cnt
16
16
grade = round (0.0588 * l - 0.296 * s - 15.8 )
17
17
18
- if ( grade < 1 ) :
18
+ if grade < 1 :
19
19
print ("Before Grade 1" )
20
- elif ( grade > 16 ) :
20
+ elif grade > 16 :
21
21
print ("Grade 16+" )
22
22
else :
23
23
print (f"Grade { grade } " )
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ def main():
5
5
s = count_sentences (text ) * 100 / count_words (text )
6
6
grade = round (0.0588 * l - 0.296 * s - 15.8 )
7
7
8
- if ( grade < 1 ) :
8
+ if grade < 1 :
9
9
print ("Before Grade 1" )
10
- elif ( grade > 16 ) :
10
+ elif grade > 16 :
11
11
print ("Grade 16+" )
12
12
else :
13
13
print (f"Grade { grade } " )
@@ -26,7 +26,7 @@ def count_words(text):
26
26
for i in range (len (text )):
27
27
if text [i ].isspace ():
28
28
cnt += 1
29
- return cnt + 1
29
+ return cnt + 1
30
30
31
31
32
32
def count_sentences (text ):
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def main():
25
25
for i in range (len (data )):
26
26
matches = 0
27
27
for j in range (1 , len (reader .fieldnames )):
28
- if int (data [i ][reader .fieldnames [j ]]) == STR [j - 1 ]:
28
+ if int (data [i ][reader .fieldnames [j ]]) == STR [j - 1 ]:
29
29
matches += 1
30
30
if matches == len (reader .fieldnames ) - 1 :
31
31
print (data [i ]['name' ])
@@ -34,7 +34,7 @@ def main():
34
34
35
35
36
36
def longest_match (sequence , subsequence ):
37
- """Returns length of longest run of subsequence in sequence."""
37
+ """Returns length of the longest run of subsequence in sequence."""
38
38
39
39
# Initialize variables
40
40
longest_run = 0
You can’t perform that action at this time.
0 commit comments