import wikipedia def main(): # No error handling included. # It is better to use lists. print('''Wikipedia pages near the following attractions (1 to 5) (1) Golden Gate Bridge (2) Brooklyn Bridge (3) San Jacinto battleground monument (4) Johnson Space Center (5) University of Houston-Clear Lake ''') # Get user input choices from 1 to 5. choice = int(input('your choice from 1 to 5: ')) match choice: case 1: target = "Golden Gate Bridge" case 2: target = "Brooklyn Bridge" case 3: target = "San Jacinto Monument" case 4: target = "Johnson Space Center" case 5: target = "University of Houston–Clear Lake" page = wikipedia.page(target, auto_suggest=False) target_lat = page.coordinates[0] target_lon = page.coordinates[1] # Perform a geosearch around the Golden Gate Bridge nearby_pages = wikipedia.geosearch(target_lat, target_lon, results=5, radius=10000) print(f"Wikipedia page title: {target}") print(f" Page URL: {page.url}") summary = wikipedia.summary(target, sentences=3, auto_suggest=False) print(f" Summary:\n{summary}") print(f" Page coordinates: ({target_lat:.12f}, {target_lon:.12f})") print(f" Wikipedia pages nearby: ") for page_title in nearby_pages: print(f" -- {page_title}") if __name__ == "__main__": main()