Python 3.10 Fizzbuzz

Hen Hanna henhanna at gmail.com
Sun Feb 26 16:07:19 EST 2023


On Monday, August 29, 2022 at 7:18:22 PM UTC-7, Paul Rubin wrote:
> Just because. 
> 
> from math import gcd 

> def fizz(n: int) -> str: 
>        match gcd(n, 15): 
>               case 3: return "Fizz" 
>               case 5: return "Buzz" 
>               case 15: return "FizzBuzz" 
>               case _: return str(n) 
> 
> for i in range(1,101): 
>             print(fizz(i))


is there any reason to prefer    "    over    '   ?


More information about the Python-list mailing list