Writing Code for FizzBuzz in a way it can be extended to check for more words without a hideous if then refactor that would be error prone and tedious.
Timestamps:
00:00 How can a FizzBuzz solution be the best
01:35 What is the FizzBuzz interview programming problem
01:57 Start of basic FizzBuzz code
06:00 Why the basic if else FizzBuzz code falls apart while adding another "Bang" word
10:10 Best extensible FizzBuzz algorithm on YouTube
11:46 Adding Bang into our FizzBuzz logic the easy way
13:55 Adding Foo into our algorithm for FOUR different multiples checks
15:00 Wrapping up discussion and outro
=== Code ===
modulo_list = [(3,"Fizz"),(5,"Buzz")]
for i in range(1,101):
print_string = ""
for mod in modulo_list:
if i % mod[0] == 0:
print_string += mod[1]
if print_string == "":
print(i)
else:
print(print_string)
===========
For more python and software development content from me please visit my blog at https://beapython.dev/ also subscribe to the channel! It's free and helps push me to make more experience based tutorials.
Nesta página do site você pode assistir ao vídeo on-line BEST FizzBuzz Python Code on YouTube Because Extensibility Matters duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário BeAPythonDev 27 Agosto 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 728 vezes e gostou 17 espectadores. Boa visualização!