Python 3.10 Fizzbuzz

avi.e.gross at gmail.com avi.e.gross at gmail.com
Sun Feb 26 22:36:23 EST 2023


Only sometimes.

Is it an insult to suggest the question about what quotes to use is quite basic? Python has a wide variety of ways to make a string and if you have text that contains one kind of quote, you can nest it in the other kind. Otherwise, it really does not matter.

And, yes, there are triply quoted strings as well as raw and formatted but to know about these things, you might have to read a manual.

Since you won't, I provided an answer. The answer is that for the meaningless Fizzbuzz homework type of problem which is just ASCII text, it does not matter at all which kind of quote you use as long as what you use matches itself at the end of the string and as long as you use the ASCII versions, not the ones you might make in programs like WORD that have a pair for each.

Oh, by the way, people here use lots of editors to deal with their code including versions derived from vi and emacs and MANY others, so many people here need to be told why you are asking some of your editing questions that do not at first seem to relate. We strive to focus here a bit more on using the language than on how to make your editor do tricks.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com at python.org> On Behalf Of Hen Hanna
Sent: Sunday, February 26, 2023 4:07 PM
To: python-list at python.org
Subject: Re: Python 3.10 Fizzbuzz

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    '   ?
-- 
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list