asdasd
unknown
python
2 years ago
1.8 kB
1
Indexable
Never
deprem = input("Please enter the dataset: ") aranan = input("Please enter the earthquake that you want to look for: ") km = input("Please enter the radius (in km): ") if aranan not in deprem: print (aranan, "is not in the database.") deprem = deprem.replace(":", ",") deprem = deprem.replace(";", ",") mylist = deprem.split(",") index = mylist.index(aranan) #print (index) #print (deprem)http://localhost:8889/notebooks/Desktop/Python_Jupyter/sketchbook.ipynb# #print (mylist[index+1]) #shock = shock[] print("For the earthquake", aranan, "; following(s) are the foreshocks and aftershocks:") print("----------------------------------------------------------------------------") shock = [] i = 1 while i in range(len(mylist)): if int(mylist[index+1])-86400 < int(mylist[i]) < int(mylist[index+1])+86400: shock.append(mylist[i-1]) if aranan in shock: shock.remove(aranan) #print("* Earthquake", mylist[i - 1], "with latitude", mylist[i + 1], "and longitude", mylist[i + 2] + ".") i += 4 if len(shock) <= 0: print("pipi") z = 0 while z in range(len(mylist)): for j in range(len(shock)): print(j) if shock[j] in mylist: ix = mylist.index(shock[j]) distance = 100* ((float(mylist[z + 3]) - float(mylist[ix + 3]))**2 + (float(mylist[z + 2]) - float(mylist[ix + 2]))**2)**1/2 if distance > float(km): shock.remove(shock[j]) z += 4 if len(shock) <= 0: print("pipi") for i in shock: if i in mylist: ix = mylist.index(i) print("* Earthquake", mylist[ix], "with latitude", mylist[ix + 2], "and longitude", mylist[ix + 3] + ".") #print (shock)