Hi,
I seem to be stuck on the "While" loop in Chapter 2 - page 72. The odd thing is that I had done this exercise previously a few weeks ago and everything worked fine. I went back to "practice" and re-do some of the exercises but now I'm getting different results, or in this case no result. Very confused as I am new to programming (hence my purchase of this book!) To my knowledge, nothing has changed on my PC.
Please Help !!! I am using Python 3.2 on a Windows XP OS.
Thanks,
John
******************************************************************
Here is the relevant code and shell when I run it :
import urllib.request
import time
price = 99.99
while price > 4.50:
page = urllib.request.urlopen("http://beans-r-us.biz/prices.html")
text = page.read().decode("utf8")
where=text.find('>$')
pricebeg = where+2
priceend = pricebeg + 4
price = float(text[pricebeg:priceend])
time.sleep(60)
print ("BUY Smartypants!")
After saving the code and hitting F5 to run it, this is the shell (i.e. nothing):
Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
>>> ================================ RESTART ================================
>>>











