Fix typos and add Python files
This commit is contained in:
parent
cddc649b7f
commit
776b96e52e
6 changed files with 215 additions and 3 deletions
23
thinkcspy/Chapter-11-Exercises/Python-files/Problem3.py
Normal file
23
thinkcspy/Chapter-11-Exercises/Python-files/Problem3.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Runestone.Academy thinkcspy course
|
||||
# Chapter 11
|
||||
# Problem 3
|
||||
|
||||
sdfile = open("studentdata.txt", "r")
|
||||
|
||||
for line in sdfile:
|
||||
student = line.split()
|
||||
mingrade = student[1]
|
||||
maxgrade = student[1]
|
||||
|
||||
for grade in student:
|
||||
if grade != student[0]:
|
||||
if int(grade) < int(mingrade):
|
||||
mingrade = grade
|
||||
if int(grade) > int(maxgrade):
|
||||
maxgrade = grade
|
||||
|
||||
outputText = "{} - minimum score:{}; maximum score:{}".format(student[0], mingrade, maxgrade)
|
||||
|
||||
print(outputText)
|
||||
|
||||
sdfile.close()
|
||||
Loading…
Reference in a new issue