-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
64 lines (52 loc) · 1.49 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import requests
def get_joke():
url = 'https://official-joke-api.appspot.com/jokes/programming/random'
response = requests.get(url)
joke = response.json()
return joke
def cat_facts():
url = 'https://catfact.ninja/facts'
response = requests.get(url)
facts = response.json()
return facts
def get_name():
url = 'https://tools.estevecastells.com/api/cats/v1'
response = requests.get(url)
name = response.json()
return name
def main():
cat = """ _._ _,-'""`-._
(,-.`._,'( |\\`-/|
`-.-' \\ )-`( , o o)
`- \\`_`"'-
"""
print("Welcome to Catagotchi! Your new (cute) cat friend!")
print(cat)
print("What would you like to do?")
print("1. Get a fun joke")
print("2. Get a cat fact")
print("3. Get a cat name")
print("4. Pet the cat :3")
print("5. Quit")
while True:
choice = input("Enter your choice: ")
if choice == '1':
joke = get_joke()
print(joke[0]['setup'])
print(joke[0]['punchline'])
elif choice == '2':
facts = cat_facts()
print(facts['data'][0]['fact'])
elif choice == '3':
name = get_name()
print(name[0])
elif choice == '4':
print("You pet the cat! :3")
print(cat)
elif choice == '5':
print("Goodbye!")
break
else:
print("Invalid choice. Please try again.")
if __name__ == '__main__':
main()