Skip to content
Permalink
Browse files
Update Factfunction.py
  • Loading branch information
khalifas2 committed Nov 26, 2021
1 parent f7c93a7 commit e48b04a906a01c0554d067d8ea6d51ed06383b50
Showing 1 changed file with 39 additions and 41 deletions.
@@ -16,48 +16,46 @@ def factfunction():
for ii in replyList3:
if ii == decisionC:
print(random.choice(replyList1))
historyList = ["About one third of Ancient Greeks were slaves",
"Ancient Egyptiants used mouldy bread to heal wounds quickly and a lot of the time, it worked!",
"Leonardo Da Vinci was born near Florence in Italy in 1452."]
sportsList = ["Olympic Gold Medals are Predominantly Made from Sterling Silver",
"The First Recorded Diving Championship in the UK Took Place in 1889",
"Ski Ballet Used to be a Competitive Sport"]
scienceList = ["Some metals are so reactive that they explode on contact with water",
"In 2.3 billion years it will be too hot for life to exist on Earth",
"It takes 8 minutes, 19 seconds for light to travel from the Sun to the Earth"]
geographyList = ["Hawaii moves 7.5cm closer to Alaska every year",
"20% of Earth's oxygen is produced by the Amazon rainforest",
"Ninety percent of the Earth's population lives in the Northern Hemisphere"]
print("Which subject would you like to learn facts about?")
while True:
print("Pick a letter: A)History, B)Sports, C)Science, D)Geography,E)Random Fact ")
decisionA = input()
if (decisionA == 'A'):
print(random.choice(historyList))
elif (decisionA == 'B'):
print(random.choice(sportsList))
elif (decisionA == 'C'):
print(random.choice(scienceList))
elif (decisionA == 'D'):
print(random.choice(geographyList))
elif (decisionA == 'E'):
import requests
url = "https://facts-by-api-ninjas.p.rapidapi.com/v1/facts"
headers = {
historyList = ["About one third of Ancient Greeks were slaves",
"Ancient Egyptiants used mouldy bread to heal wounds quickly and a lot of the time, it worked!",
"Leonardo Da Vinci was born near Florence in Italy in 1452."]
sportsList = ["Olympic Gold Medals are Predominantly Made from Sterling Silver",
"The First Recorded Diving Championship in the UK Took Place in 1889",
"Ski Ballet Used to be a Competitive Sport"]
scienceList = ["Some metals are so reactive that they explode on contact with water",
"In 2.3 billion years it will be too hot for life to exist on Earth",
"It takes 8 minutes, 19 seconds for light to travel from the Sun to the Earth"]
geographyList = ["Hawaii moves 7.5cm closer to Alaska every year",
"20% of Earth's oxygen is produced by the Amazon rainforest",
"Ninety percent of the Earth's population lives in the Northern Hemisphere"]
print("Which subject would you like to learn facts about?")
while True:
print("Pick a letter: A)History, B)Sports, C)Science, D)Geography,E)Random Fact ")
decisionA = input()
if (decisionA == 'A'):
print(random.choice(historyList))
elif (decisionA == 'B'):
print(random.choice(sportsList))
elif (decisionA == 'C'):
print(random.choice(scienceList))
elif (decisionA == 'D'):
print(random.choice(geographyList))
elif (decisionA == 'E'):
import requests
url = "https://facts-by-api-ninjas.p.rapidapi.com/v1/facts"
headers = {
'x-rapidapi-host': "facts-by-api-ninjas.p.rapidapi.com",
'x-rapidapi-key': "f07e1a114fmshd50bd4cab97dab2p14d6e6jsnf28475c2608a"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
else:
print("Invalid Input")
decisionB = input("Do you want to start over to learn another fact? ")
if (decisionB == 'yes'):
loopCounter = loopCounter + 1
else:
print("Bye")
exit()
return False


response = requests.request("GET", url, headers=headers)
print(response.text)
else:
print("Invalid Input")
decisionB = input("Do you want to start over to learn another fact? ")
if (decisionB == 'yes'):
loopCounter = loopCounter + 1
else:
print("Bye")
exit()
return False
factfunction()

0 comments on commit e48b04a

Please sign in to comment.