After lecture 20251112

This commit is contained in:
Edward Bigos 2025-11-12 10:38:37 -05:00
parent c6dcbb0606
commit dc82c5032c
6 changed files with 48 additions and 2 deletions

View file

@ -0,0 +1,5 @@
import requests,json;
url = 'https://vpic.nhtsa.dot.gov/api/vehicles/GetModelsForMakeId/440?format=json';
r = requests.get(url);
print(r.text);

View file

@ -1,5 +1,6 @@
import numpy as np
from numpy import pi
np.linspace(0, 2, 9) # 9 numbers from 0 to 2
x = np.linspace(0, 2 * pi, 100) # useful to evaluate function at lots of points
f = np.sin(x)

View file

@ -22,7 +22,7 @@ def prettyPrintDictionary(myDict):
joke = get_joke()
#prettyPrintDictionary(joke)
prettyPrintDictionary(joke)
print(joke['value'])

View file

@ -13,4 +13,5 @@ result = json.loads(response.read())
print(result)
print("\nPrint using Pretty Print\n")
pprint.pprint(result)

View file

@ -0,0 +1,39 @@
import json
import urllib.request
import turtle
import time
url = 'http://api.open-notify.org/astros.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())
import pprint
print(result)
print("People on the ISS: ",result['number'])
people = result['people']
#print(people)
#for person in people:
# print(person)
print("People on the ISS right now.")
for person in people :
print(f"\t {person['name']}")
url = 'http://api.open-notify.org/iss-now.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())
pprint.pprint(result)
location = result['iss_position']
latitude = location['latitude']
longitude = location['longitude']
print("The current position")
print('Latitude: ',latitude)
print('Longitude: ',longitude)

View file

@ -52,4 +52,4 @@ iss.goto(float(longitude),float(latitude) )
# Print the map
time.sleep(10)
time.sleep(15)