Python Challenges: Fizzbuzz

Transcript

English (Auto-generated)

who everybody, I hope everybody is doing it very well. So today we're gonna do a problem that you've probably heard of before which is called fizz buzz. So basically consists of look us here in comments so we can have almost kind of like a skeleton problem what we want to do. So basically we're gonna go through The number is one through 100. Then I wanna check if that number is visible, this number by three and then if so we're gonna print fizz Um we also didn't check if the number is divisible by five and if that's the case we print funds and if numb is divisible by both, then we're gonna print fits buttons aside from that fif none of these apply to it. Then we're just gonna print no, okay, sounds simple enough. So let's go through it. So we're gonna start off by making you 40 because we're going to check each thing right before I in let's say range, range right? There is gonna be one and 100. Range is basically just a way of passing through each thing from here to here. Okay, so now that we have that we're going to check if if I is divisible by three and I'm gonna explain this code. And second look. So basically this sign here is called module. And basically what module does is it checks the remainder of a division the division between this number and that number. So right now is checking the remainder of the division I divided by three. Let's say I was six, six divided by three with a remainder of zero because it's divisible by three. Okay? So that's kind of how it checks and it's and then if that's the case, we're gonna print it, But first we want to check if it's divisible by three and visible By five. Okay? And then we're gonna put these buzz if that happens, and then we're gonna check Mhm Ellis right here, Ellis, I want those 30, so it's 300.3, we're going to print since And another another here, and I'm watching five goes zero. Okay, so basically if it's visible like that we're going to print runs okay? And else because if anything else is the case, as in it's not divisible by three or five, then we're just gonna print the number. Okay, so now we can get rid of our comments here and try to test it out here. Okay, now we're gonna look at a few numbers just to make sure that our looks accordingly because it might be printing fizz fizz buzz and all that random numbers. So let's see, so the Prince fizz at three and three divided by three is definitely is definitely divisible by three. We can also go ahead and check for example six also says Buzz, five is divisible by five, so it says is uh and etcetera for example, 15 is both divisible by three and five. So it says fizz buzz, Let's check another one. That should be 30. Also divisible by three and 55. And yeah, so it works perfectly right here. So now we're just basically gonna go ahead and consider this problem done. So I hope this was a fairly simple problem for you guys. Elizabeth is a very popular problem because it's a popular interview question that um that you started giving. And you might ask yourself like why are they giving out problems like these interviewers if they're so basic? And the answer to that is that a lot of programmers well back there or it might still be I'm not sure programmers are applying to these jobs. I mean jobs and like they would hire these programmers and they wouldn't know how to do anything. Like anything. Even the most basic thing. This is kind of to cancel out the programmers that that have applied to like jobs and stuff that don't know this is kind to cancel the mountain. So what I'm gonna do, you know I've heard that a loop between the number 1 10 and yeah, it was just a chaos. So this right here is definitely better. So yeah, thank you. So you guys so much for joining my code a cast and Yeah, well I'll hopefully be more in touch soon like because I was not able to do code a cast for a while and I apologize for that because I was sick for a long time. I felt forever. And aside from that I would have a ton of work. So I appreciate you guys for standing by and make be sure to be expecting a lot more code casts. Thank you and goodbye.
51 Views 1 Likes 0 Comments

Today we're doing the classic interview challenge, Fizzbuzz! It's a very beginner friendly problem :)

Comment
Leave a comment (supports markdown format)