2. Reading the file surf_en.txt
¶
Data file:
surf_en.txt
5
file = open("surf_en.txt")
for line in file:
print(line.strip())
file.close()
Activity: 2.2 ActiveCode (ac_l37_2a_en)
2.1. For loop breakdown¶

2.2. Find out who got the highest score¶

2.4. Finding the 1st place¶
9
file = open("surf_en.txt")
highest_score = 0
for line in file:
name, score = line.split()
if float(score) > highest_score:
highest_score = float(score)
file.close()
print(highest_score)
Activity: 2.4.1 ActiveCode (ac_l37_2b_en)
You have attempted 1 of 4 activities on this page