We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6490896 commit fa626b4Copy full SHA for fa626b4
1 file changed
implement-cowsay/cow.py
@@ -15,6 +15,14 @@
15
message = " ".join(args.message)
16
animal = args.animal or "cow"
17
18
+listed_animals = [listed_animal for listed_animal in dir(cowsay) if callable(getattr(cowsay, listed_animal)) and not listed_animal.startswith("__")]
19
+
20
+if animal not in cowsay.listed_animals():
21
+ print(f"Error: argument --animal: invalid choice: '{animal}'")
22
+ exit(1)
23
24
animal_says = getattr(cowsay, animal)
25
26
print(animal_says(message))
27
28
+print(dir(cowsay))
0 commit comments