diff --git a/Work/bounce.py b/Work/bounce.py index 3660ddd82..78a623ebc 100644 --- a/Work/bounce.py +++ b/Work/bounce.py @@ -1,3 +1,11 @@ # bounce.py # # Exercise 1.5 + +height = 100 #meters +rebound = 3/5 +numBounces = 10 + +for i in range(numBounces): + height = height * rebound + print(i, round(height,4)) diff --git a/Work/sears.py b/Work/sears.py new file mode 100644 index 000000000..8add59254 --- /dev/null +++ b/Work/sears.py @@ -0,0 +1,15 @@ +# sears.py + +bill_thickness = 0.11 * 0.001 # Meters (0.11 mm) +sears_height = 442 # Height (meters) +num_bills = 1 +day = 1 + +while num_bills * bill_thickness < sears_height: + print(day, num_bills, num_bills * bill_thickness) + day = day + 1 + num_bills = num_bills * 2 + +print('Number of days', day) +print('Number of bills', num_bills) +print('Final height', num_bills * bill_thickness) \ No newline at end of file diff --git a/Work/whereIsMyData.py b/Work/whereIsMyData.py new file mode 100644 index 000000000..5f10dcbd5 --- /dev/null +++ b/Work/whereIsMyData.py @@ -0,0 +1,9 @@ +import urllib +import urllib.request + +u = urllib.request.urlopen('https://data.usgs.gov/datacatalog/metadata/USGS.db4fb1b6-1282-4e5b-9866-87a68912c5d1.xml') +from xml.etree.ElementTree import parse +doc = parse(u) +for title in doc.findall('.//title'): + print(title.text) +