Hello world
print("hello world!")
word_guesser.py
secretWord = "FOX"
guessedLetters = ['_' for letter in secretWord]
def guessLetter(letter):
print("Guessed:", letter)
found = False
win = False
for i in range(len(secretWord)):
if letter == secretWord[i] and guessedLetters[i] != letter:
guessedLetters[i] = letter
found = True
if checkWin():
win = True
print(*guessedLetters)
if found:
print("Found a letter!")
if win:
print("Congrats! You guessed the word!")
def checkWin():
for i in range(len(secretWord)):
if secretWord[i] != guessedLetters[i]:
return False
return True
guessLetter("E")
guessLetter("A")
guessLetter("O")
guessLetter("B")
guessLetter("F")
guessLetter("O")
guessLetter("X")
guessLetter("X")
weather_map.py
import datetime
import json
import requests
user_id = ""
user_apiid = ""
zip_code = "30092"
weather_res = requests.get("https://api.openweathermap.org/data/2.5/weather"
+ f"?zip={zip_code}"
+ f"&appid={user_apiid}"
+ "&units=imperial").json()
print("ZIP code: \t", zip_code)
print("Name: \t", weather_res["name"])
print("Current temperature: \t", weather_res["main"]["temp"], "°F")
print("Atmospheric pressure:\t", weather_res["main"]["pressure"], "hPa")
print("Wind speed \t", weather_res["wind"]["speed"], "mph")
print("Wind direction \t",
weather_res["wind"]["deg"], "° clockwise from north")
report_time = datetime.datetime.fromtimestamp(weather_res["dt"])
print("Time of report \t", report_time.isoformat(sep=' '))