Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
980 B
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)
#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


print (shock)