Advertisement
WupEly

Untitled

Nov 21st, 2022
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import sqlite3
  2.  
  3.  
  4. def sort_fst(n):
  5. return int(str(n[0])+str(n[1]))
  6.  
  7.  
  8. name = input()
  9. fst_rule = input()
  10. scnd_rule = input()
  11. rules = f"(NOT {fst_rule}) and (NOT {scnd_rule})"
  12. coords = []
  13.  
  14. conn = sqlite3.connect(name)
  15.  
  16. cursor = conn.cursor()
  17.  
  18. request = f"SELECT latitude, longitude FROM Island WHERE {rules}"
  19.  
  20. for row in cursor.execute(request):
  21. coords.append(row)
  22.  
  23. conn.close()
  24.  
  25. coords.sort(key=sort_fst )
  26.  
  27. for coord in coords:
  28. print(coord)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement