Page 152 -
P. 152

data in files and arrays


                            Code Magnets

                            You need to complete the code to find the highest score in the
                            results.txt file. Remember: the for loop creates a string from
                            each line in the file.
                            Hint: For the program to work, you will need to convert the string
                            into a number.



                              highest_score = 0

                              result_f = open("results.txt")

                              for line in result_f:
                                  if         (          )                        :

                                                        =          (         )

                              result_f.close()

                              print("The highest score was:")

                              print(highest_score)























                                                    >
                                                          line
                                                                            line
                       highest_score
                                              float
                                                                                        float
                                                               highest_score


                                                                                       you are here 4    117
   147   148   149   150   151   152   153   154   155   156   157