Page 96 -
P. 96

textual data


                      Code Magnets

                      The program code to add the feature is sitting on the fridge door.
                      Your job is to arrange the magnets so that the program loops until
                      the price falls to $4.74 or lower.

































                   text = page.read().decode("utf8")
                                                                  price = 99.99

                                                                              import urllib.request
                 price = text[start_of_price:end_of_price]


                                                                   where = text.find(‘>$’)
                        start_of_price = where + 2                          print ("Buy!")



                            end_of_price = start_of_price + 4                    while price > 4.74:






                  page = urllib.request.urlopen("http://www.beans-r-us.biz/prices.html")




                                                                                        you are here 4    61
   91   92   93   94   95   96   97   98   99   100   101