Return to Video

FizzBuzz - Web Development

  • 0:00 - 0:04
    Okay, how did you do? Spectacularly well, I hope. Lets
  • 0:04 - 0:07
    go over the solution. Okay, so my solution looks something
  • 0:07 - 0:10
    like this. First we have an ordered list at the
  • 0:10 - 0:13
    top and bottom. You know? Opening and closing. And then
  • 0:13 - 0:18
    we have a for loop for going over the range from 1 to n plus 1 and then we say,
  • 0:18 - 0:22
    basically, if x is divisible, and we can use the
  • 0:22 - 0:25
    mod operator to determine if something is divisible. Mod basically
  • 0:25 - 0:28
    says, it gives you, it gives you the remember. So, x
  • 0:28 - 0:31
    is divided by 15, what is the remainder. If that, If
  • 0:31 - 0:34
    that's zero that means x is divisible by both 3 and
  • 0:34 - 0:38
    5 we print FizzBuzz. If it's divisible by 3 we print Fizz,
  • 0:38 - 0:42
    if it's divisible by 5 we print Buzz, else we just
  • 0:42 - 0:45
    print x. And we have our end if and our end for.
  • 0:45 - 0:48
    Okay, not too bad huh? Now there's lots of ways of,
  • 0:48 - 0:51
    you know, if you want to minimize the logic done here but
  • 0:51 - 0:52
    that's not really what I'm trying to look for right here. I
  • 0:52 - 0:55
    just want to see if you can actually use your for statements
  • 0:55 - 0:56
    and your if statements and your
  • 0:56 - 0:59
    variable substitution. And your variable substitution
  • 0:59 - 1:03
    to make a quick little template. So if you got that, nicely done.
タイトル:
FizzBuzz - Web Development
概説:

more » « less
Video Language:
English
Team:
Udacity
プロジェクト:
CS253 - Web Development
Duration:
01:04

English subtitles

改訂 Compare revisions