1 00:00:00,006 --> 00:00:04,787 [MUSIC] 2 00:00:04,787 --> 00:00:06,860 Hey, Ken here. 3 00:00:06,860 --> 00:00:10,780 In this Python practice session, you'll get a chance to practice working with data 4 00:00:10,780 --> 00:00:15,780 types, making comparisons and reinforcing your skills with if and 5 00:00:15,780 --> 00:00:19,080 else if statements, it reinforces what you've learned. 6 00:00:20,230 --> 00:00:23,660 If you find this practice session too challenging to complete, 7 00:00:23,660 --> 00:00:25,780 you might need to review that course. 8 00:00:25,780 --> 00:00:28,480 I've put a few links in the teacher's notes for some resources. 9 00:00:29,498 --> 00:00:31,840 We'll be using workspaces for this practice, so 10 00:00:31,840 --> 00:00:33,830 go ahead and open the attached workspace. 11 00:00:33,830 --> 00:00:40,350 If we open up challenge.py here, we see some starter code to get us going. 12 00:00:41,380 --> 00:00:44,870 The challenge we'll be solving is actually a common one that you might 13 00:00:44,870 --> 00:00:47,336 see in your career and it's known as fizz buzz. 14 00:00:47,336 --> 00:00:48,988 Wait what? 15 00:00:48,988 --> 00:00:50,640 Fizz buzz? 16 00:00:50,640 --> 00:00:53,990 Programmers come up with some funny names for things. 17 00:00:53,990 --> 00:00:58,210 Actually it comes from a kid's math game to teach division. 18 00:00:58,210 --> 00:00:59,580 Check the teachers notes for more. 19 00:01:00,600 --> 00:01:03,740 Anyway here's the concept of Fizz Buzz. 20 00:01:03,740 --> 00:01:06,150 We'll ask a user to input a number. 21 00:01:06,150 --> 00:01:11,110 If the number is divisible by the number 3 remember the module operator we 22 00:01:11,110 --> 00:01:11,990 print Fizz. 23 00:01:13,030 --> 00:01:17,322 If it's divisible by the number 5 we print Buzz. 24 00:01:17,322 --> 00:01:22,949 If it's divisible by both 3 and 5 we print Fizz Buzz. 25 00:01:22,949 --> 00:01:25,672 We'll be adding in some additional features, as well, 26 00:01:25,672 --> 00:01:27,270 like printing the user's name. 27 00:01:28,500 --> 00:01:29,490 Don't worry. 28 00:01:29,490 --> 00:01:31,000 You've got this. 29 00:01:31,000 --> 00:01:34,700 We've covered all the skills needed to do this challenge. 30 00:01:34,700 --> 00:01:39,190 Right now, the code is asking users for their name and a number. 31 00:01:39,190 --> 00:01:43,820 I've included some to-do code comments for items for you to complete. 32 00:01:43,820 --> 00:01:47,340 I'd like you to read through the to do comments and complete each one. 33 00:01:47,340 --> 00:01:50,320 Let's see the completed program in action. 34 00:01:50,320 --> 00:01:52,114 Remember, to run a Python file, 35 00:01:52,114 --> 00:01:55,780 we use the Python command along with the file name we'd like to run. 36 00:02:04,401 --> 00:02:11,720 We do python, challenge.py. 37 00:02:11,720 --> 00:02:13,160 Program prompts me for a name. 38 00:02:13,160 --> 00:02:16,250 My name is Ken. 39 00:02:16,250 --> 00:02:17,520 Remember. 40 00:02:17,520 --> 00:02:18,210 Let's try number 6. 41 00:02:18,210 --> 00:02:22,580 I then prints out my name. 42 00:02:22,580 --> 00:02:26,340 The number I put in and the appropriate Fizz Buzz response. 43 00:02:26,340 --> 00:02:30,750 We see that the number 6 is a Fizz, it's divisible by 3. 44 00:02:30,750 --> 00:02:31,260 That's great. 45 00:02:32,280 --> 00:02:34,669 Let's run it again to see responses for different numbers. 46 00:02:37,859 --> 00:02:38,480 Ken. 47 00:02:39,910 --> 00:02:42,600 We do 10, it's a Buzz. 48 00:02:42,600 --> 00:02:43,100 Cool! 49 00:02:48,360 --> 00:02:49,895 Number 8 that's neither 50 00:02:53,827 --> 00:02:58,360 Let's try 45, which should be, yep, there it is. 51 00:02:58,360 --> 00:03:01,010 It's a FizzBuzz and that's it. 52 00:03:01,010 --> 00:03:04,130 If you get stuck along the way, check out the teacher's notes for 53 00:03:04,130 --> 00:03:07,380 links to videos that cover the concepts needed to complete the session. 54 00:03:08,420 --> 00:03:11,870 If you're not able to fully complete the program don't worry. 55 00:03:11,870 --> 00:03:16,020 When we get back together I'll walk you through on my approach in the next video. 56 00:03:16,020 --> 00:03:16,580 See you soon.