You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"science": "Honey never spoils. Archaeologists have found pots of honey in ancient Egyptian tombs that are over 3,000 years old and still perfectly edible.",
4
+
"history": "The shortest war in history lasted only 38 minutes. It was between Britain and Zanzibar on August 27, 1896.",
5
+
"animals": "Penguins only have one mate their entire life. They also propose to their lifemates with a pebble.",
6
+
"technology": "The first computer virus was created in 1983 and was called the 'Elk Cloner'. It infected Apple II computers via floppy disks."
7
+
}
8
+
9
+
category_lower=category.lower()
10
+
ifcategory_lowerinfacts:
11
+
returnfacts[category_lower]
12
+
else:
13
+
return"Sorry, I don't have an interesting fact for that category."
assertfact=="Honey never spoils. Archaeologists have found pots of honey in ancient Egyptian tombs that are over 3,000 years old and still perfectly edible."
6
+
7
+
deftest_history_fact():
8
+
fact=get_interesting_fact("history")
9
+
assertfact=="The shortest war in history lasted only 38 minutes. It was between Britain and Zanzibar on August 27, 1896."
10
+
11
+
deftest_animals_fact():
12
+
fact=get_interesting_fact("animals")
13
+
assertfact=="Penguins only have one mate their entire life. They also propose to their lifemates with a pebble."
14
+
15
+
deftest_technology_fact():
16
+
fact=get_interesting_fact("technology")
17
+
assertfact=="The first computer virus was created in 1983 and was called the 'Elk Cloner'. It infected Apple II computers via floppy disks."
18
+
19
+
deftest_invalid_category():
20
+
fact=get_interesting_fact("invalid")
21
+
assertfact=="Sorry, I don't have an interesting fact for that category."
0 commit comments