Python Interview Question - Fizz Buzz

preview_player
Показать описание
In this video I go over a very simple yet frequently asked coding interview question called Fizz Buzz.
this question has 4 conditions that must be met:
1. If the input is divisible by 3, the function will return the string "fizz"
2. If the input is divisible by 5 it will return "Buzz"
3. If the input is divisible by both 3 and 5 it will return "FizzBuzz"
4. For any other number it will return the same input
Рекомендации по теме
Комментарии
Автор

could also use elif which would be more effecient

AffectionateFlamingos-irjz
Автор

Ok, YouTube put me this video in the face, and since this is my favorite problem to test a developer in an interview, let me tell you what comes to my mind when I see your code:

First, the name of the function is a mix of cammelCase and snake_case which tell me the dev is not familiarized with the style guides of the language.

Also when you copy/paste the longest if statement from bottom to top you leave a break line and never went back to delet it. Also you missed a white space in the module operation.

The name of the param is too generic. Find the right name for the right variable is specially important on dynamic typed languages.

You have duplication of code; you ask for the module of 3 twice and for module of 5 as well.

All of this tell me about a careless or inexperienced developer. Nothing that cannot be fixed with proper guidance.

So at this point I make questions about the destion making; if the developer get their ego hurt, or they is aprehensive, they get get automatically rejected. If the developer shows curiosity about others posible solutions then we got a winner.

Some times, depending of the flow of the interview or how much expertice is required for the job I add a couple of request:

- Instead of showing "Buzz" on the 5, it should do it in the 7
- It should show "Bazz" on the 9
- It should show "Bezz" on the 11

ascetahedonista
Автор

It keeps on printing ‘none’ on the screen. I copied your code, proper indentations.

CryptoDexter