Skip to content

Commit b8c50bf

Browse files
authored
Fixed Lint errors
1 parent 9250c3a commit b8c50bf

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

3_advanced/chapter14/solutions/worried_josh.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
#Problem Name: worried_josh
1+
# Problem Name: worried_josh
22

3-
#Josh is worried about his test score. He wants to score in the top n, where n is a positive integer that the user inputs. Given a list of student names where the student with the highest score is the 0th index and the score goes down from there, print “YES!” if Josh scores in the top n, and “NO :(“ if he doesn’t. Assume n will not be greater than the number of students. Use enumerate to solve this problem.
3+
"""
44
5+
Josh is worried about his test score. He wants to score in the top n,
6+
where n is a positive integer that the user inputs. Given a list of
7+
student names where the student with the highest score is the 0th index
8+
and the score goes down from there, print “YES!” if Josh scores in the top n,
9+
and “NO :(“ if he doesn’t. Assume n will not be greater than the number of students.
10+
Use enumerate to solve this problem.
511
6-
#the list of student names is given and the n is a user input
7-
#remember the leftmost student has the highest score whereas the rightmost has the lowest score
12+
"""
13+
14+
# the list of student names is given and the n is a user input
15+
# remember the leftmost student = highest score, rightmost student = lowest score
816
students = [“Dan”, “Sherlocks”, “Jo”, “Josh”, “Dennis”, “Erwin”, “Ivan”, “Penny”]
917
n = int(input())
1018

11-
#write your code below
19+
# write your code below
20+
1221
said_yes = False
1322
for index, name in enumerate(students):
1423
if name ==Joshand index +1 <= n:

0 commit comments

Comments
 (0)