Skip to content

Commit 0a6349b

Browse files
committed
shorten 'fizzbuzz' again with an 'or' for the default case of returning the string of the number
1 parent a360763 commit 0a6349b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fizzbuzz.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66

77
def fizzbuzz(num: int) -> str:
8-
output = 'Fizz' * int(num % 3 == 0) + 'Buzz' * int(num % 5 == 0)
9-
return output if output else str(num)
8+
return ('Fizz' * int(num % 3 == 0) + 'Buzz' * int(num % 5 == 0)) or str(num)
109

1110

1211
def fizzbuzz_loop() -> Iterable[str]:

0 commit comments

Comments
 (0)