Let's write FizzBuzz

preview_player
Показать описание
FizzBuzz is a common interview question - or at least it used to be. Either way, here it is in Python.
Рекомендации по теме
Комментарии
Автор

The fact that he used "x" as a for loop variable instead of "i" is really bothering me...

isgh
Автор

the dude doing these videos deserves a raise

Iddo
Автор

python's string replication actually makes it much easier... specially *0 being an empty string

*print("\n".join("Fizz" * (i % 3 == 0) + "Buzz" * (i % 5 == 0) or str(i) for i in range(1, 101)))*

^ if you rite code like this in a real application though please make sure to comment it well cuz its small but not readable

SReaperz
Автор

At the beginning of my apprenticeship we wrote fizz buzz in basic on a c64, it was an amazing experience using that old stuff in these new years 😁😆

dermuschelschluerfer
Автор

Amazing. I used this to get my current job. Thank you!!

vkottler
Автор

You could've just printed `i or x` at the end there

huantian
Автор

Wait I didn't know vscode could do jupyter notebooks... Kinda cool, but then again I don't use python that much anyway. But if I were to, this would be the way!

barmetler
Автор

What is the best way to record vertical coding videos?

AnujSyal
Автор

I saw the prime saying that this could be interesting in interviews to see how people react when you tell them what if we want to add a rule for 7 to print Bazz

yassine-sa
Автор

print("fizz"*(x%3==0) +"buzz"*(x%5==0) or x)

AlokSingh-rjgt
Автор

I dont understand how coding without curly brackets works.

renecabuhan
Автор

Nice video, how does he get those button to run his code like that? I usually just run my code in the terminal, but this video makes it look a lot cleaner.

rock
Автор

My Consolas font looks so rough in comparison. What might be the issue? Have enabled cleartype and font settings zoom level are default.

_mohit
Автор

What I did in C is a trick with carriage returns

KSPAtlas
Автор

You can do this oneliner
[print('fizz' if i % 3 == 0 else 'buzz' if i % 5 == 0 else i, end=' ') for i in range(1, 101)]

or
print('\n'.join(['fizz'*(not i%3) + 'buzz'*(not i%5) or str(i) for i in range(1, 101)]))

easypezy
Автор

What happened at 0:27 when he wrote F3? How does this work?

thenarfer
Автор

if only this were asked in technical interviews

TheFootballPlaya
Автор

A bit of python randomness, you could also use:

not x % 3
#and
not x % 5

Because the integer 0 is falsey, not inverts it to true.

xxlarrytfvwxx
Автор

I don't really mind it(and most probably a typo (?), just threw me off a bit, Pretty sure it's "modulo" and not "modulus", modulus feels like the absolute value function

hamiltonianpathondodecahed
Автор

I don’t get why everyone is saying he’s cooked? This solution is simple and works, I’m confused by what’s supposed to be wrong here?

akaakaakaak