Skip to content

Commit 7125d1a

Browse files
If statement removed and default value added to animal flag
1 parent bd4f33e commit 7125d1a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

implement-cowsay/cow.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ def main():
1010
description="Make animals say things"
1111
)
1212

13-
parser.add_argument("--animal", choices=animals, help="The animal to be saying things.")
13+
parser.add_argument("--animal", choices=animals, default="cow",help="The animal to be saying things.")
1414
parser.add_argument("message", nargs="+", help="The message to say.")
1515

1616
args = parser.parse_args()
1717

1818
# Join all message words into a single string
1919
message = " ".join(args.message)
2020

21-
if args.animal:
22-
cowsay.char_funcs[args.animal](message)
23-
else:
24-
cowsay.cow(message)
21+
# Output the message using the selected animal or the default cow
22+
cowsay.char_funcs[args.animal](message)
23+
2524

2625
if __name__ == "__main__":
2726
main()

0 commit comments

Comments
 (0)