1 00:00:00,360 --> 00:00:01,980 Welcome back, how'd it go? 2 00:00:03,080 --> 00:00:07,360 If you weren't able to complete every to-do item, that's totally fine. 3 00:00:07,360 --> 00:00:08,580 Learning new things is hard. 4 00:00:09,710 --> 00:00:12,102 Let's walk through how I handled this challenge. 5 00:00:13,968 --> 00:00:15,120 Here's our first TODO. 6 00:00:16,720 --> 00:00:21,030 Remember that inputs are string values and we need our number to be an integer for 7 00:00:21,030 --> 00:00:22,590 our math operations. 8 00:00:22,590 --> 00:00:26,140 We can do that by passing the input into the int function. 9 00:00:31,500 --> 00:00:33,221 Let's look at our next TODO's here. 10 00:00:37,310 --> 00:00:41,860 For the next task, we need to utilize string formatting and a new line. 11 00:00:42,890 --> 00:00:46,607 We can use an escape sequence for the new line, all right? 12 00:00:46,607 --> 00:00:48,245 And we can pass in the name and 13 00:00:48,245 --> 00:00:52,690 number variables into the stringFormat method to get those values to print. 14 00:01:00,020 --> 00:01:06,650 So our next TODO here is to define our variables for is_fizz and is_buzz. 15 00:01:08,711 --> 00:01:15,600 So for is_fizz and is_buzz, we want them to be boolean values, true or false. 16 00:01:15,600 --> 00:01:20,560 For is_fizz, we do the module operator on the number, 17 00:01:20,560 --> 00:01:24,280 by 3, and make sure that that equals 0, which means there's no remainder. 18 00:01:25,330 --> 00:01:28,630 For is_buzz we do the same thing but with 5. 19 00:01:30,020 --> 00:01:33,830 Next up is handling all of this if logic. 20 00:01:33,830 --> 00:01:35,582 This may have tripped you up a little bit. 21 00:01:35,582 --> 00:01:36,319 And honestly, 22 00:01:36,319 --> 00:01:40,400 it is something that many developers struggle with from time to time. 23 00:01:40,400 --> 00:01:44,581 But thinking in this fashion early on in your Python journey helps a ton. 24 00:01:47,452 --> 00:01:52,340 Let's think about how if statements work and what we're trying to do. 25 00:01:52,340 --> 00:01:56,170 We need to check a given number for the various conditions. 26 00:01:56,170 --> 00:01:58,650 The thing to remember through the if and 27 00:01:58,650 --> 00:02:03,080 elif statements is that it processes each conditional check in order. 28 00:02:04,140 --> 00:02:08,550 If a condition is met, it does what's inside the checking block and that's it. 29 00:02:09,640 --> 00:02:14,390 Therefore, if we start with a check for just the number 3 or just the number 5, 30 00:02:14,390 --> 00:02:18,900 we'll never get to check for both of these conditions. 31 00:02:18,900 --> 00:02:21,650 Therefore, that check needs to come first. 32 00:02:22,720 --> 00:02:27,440 So we check if is_fizz and is_buzz is first. 33 00:02:28,990 --> 00:02:32,320 Then we can check the individual conditions for 3 and 34 00:02:32,320 --> 00:02:35,800 5 divisibility and print out the necessary statements. 35 00:02:36,800 --> 00:02:40,220 Finally, if none of those conditions exist, 36 00:02:40,220 --> 00:02:43,480 we can print that our number isn't fizzy or buzzy. 37 00:02:44,870 --> 00:02:47,650 Excellent work completing this practice session. 38 00:02:47,650 --> 00:02:49,780 Thanks for working through this challenge with me. 39 00:02:49,780 --> 00:02:51,940 Until next time, happy coding.