Earthquake Questions
This exercise is for collaborative work during class. Do not fill out early!
Sign in to Google to save your progress. Learn more
Consider converting the earthquake string input into the correct format.
From:

estr = "1.3%earthquake$81km SSW of Kobuk, Alaska"

To:

newstr = "earthquake, 1.3, 81km SSW of Kobuk, Alaska"

Consider the following:

A.
pos = estr.find("%")
pos2 = estr.find("$")
newstr = estr[pos:pos2] + ", " +  estr[:pos] + ", " + estr[pos2:]

B.
pos = estr.find("%")
pos2 = estr.find("$")
newstr = estr[pos+1:pos2] + ", " +  estr[:pos] + ", " + estr[pos2+1:]

C.
alist = estr.split("$")
blist = alist[0].split("%")
newstr = blist[1] + ", " + blist[0] + ", " + alist[1]

D.
alist = estr.split("$")
blist = estr.split("%")
newstr = blist[1] + ", " + blist[0] + ", " + alist[1]



Which of the following are ways to create newstr from estr?
Consider building a list of earthquake strings. How does one add a string to a list

ans = [ ]
for item in listOfEarthquakes:
    if "check some condition is true":
           LINE 4
return ans

Which of the following work for line 4 to add the earthquake to the list of earthquakes that meet the criteria?
Suppose the Earthquake data also had the longitude and latitude for each earthquake and you want to print out a specified number of  earthquakes closest to a particular location (given a longitude and latitude location).
What type of function would be better to write? *
Names and Netids below
Names (comma separated) *
netid *
netid (partner)
netid (partner)
netid (partner)
Submit
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy