PyZombis aayush/poc_pandas@68cf776
Social
Runestone in social media:
Follow @iRunestone
Our Facebook Page
Help support us:
Search
Table of Contents
Book Index
User
Assignments
Practice
Change Course
Instructor's Page
Progress Page
Edit Profile
Change Password
Register
Login
Dark Mode
Scratch Activecode
Help
FAQ
Instructors Guide
About Runestone
Report A Problem
7.
Strings are different from numbers
¶
7.1.
Convert to
float
¶
from urllib.request import urlopen URL_LOYALTY_PRICES = "https://api.allorigins.win/raw?url=http://beans.itcarlow.ie/prices-loyalty.html" page = urlopen(URL_LOYALTY_PRICES) text = page.read() location = text.find(">$") start = location + 2 end = start + 4 if float(text[start:end]) < 4.74: print("Buy! price: %5.2f" % float(text[start:end]))
7.2.
Can you keep testing the price?
¶
7.3.
Can you keep trying?
¶
from urllib.request import urlopen URL_LOYALTY_PRICES = "https://api.allorigins.win/raw?url=http://beans.itcarlow.ie/prices-loyalty.html" price = 99.99 while price >= 4.74: page = urlopen(URL_LOYALTY_PRICES) text = page.read() location = text.find(">$") start = location + 2 end = start + 4 price = float(text[start:end]) print("Buy! price: %5.2f" % price)
7.4.
The CEO is very happy!
¶
You have attempted
of
activities on this page