attempts = 3
while attempts > 0:
password = input("Enter your password:")
if password == "hello":
print("Welcome, User 1!")
elif password == "hi":
print("Welcome, user 2!")
elif password == "greetings":
print("Welcome, Doctor Evil!")
else:
print("Password incorrect.")
attempts -= 1
print("You are out of attempts.")
(Courtesy C. Merk 9/18/2025)
(Requires pip install requests, pip install geopy)
import requests
from geopy.geocoders import Nominatim
import time
def get_location_info(latitude, longitude):
geolocator = Nominatim(user_agent="location_info_app")
location = geolocator.reverse((latitude,longitude),language="en")
if location:
address = location.address
return address
else:
return "not available."
def get_iss_coordinates():
try:
response = requests.get("http://api.open-notify.org/iss-now.json")
response.raise_for_status()
data = response.json()
return data['iss_position']['latitude'], data['iss_position']['longitude']
except requests.RequestException as e:
print(f"Error: {e}")
return None, None
# Press the green button in the gutter to run the script.
def main():
while True:
latitude, longitude = get_iss_coordinates()
if latitude is not None and longitude is not None:
print(f"ISS Coordinates - Latitude: {latitude}, Longitude: {longitude}")
location_info = get_location_info(latitude, longitude)
print(f"Location information: {location_info}")
else:
print("Failed to retrieve ISS coordinates.")
time.sleep(60)
if __name__ == '__main__':
main()