Return to Video

Unplugged: For Loop Fun

  • 0:20 - 0:25
    This lesson is called For Loop Fun. In this
    lesson, we'll use a number line to play a dice game.
  • 0:27 - 0:30
    Each player will roll three times
    to assign a starting value,
  • 0:30 - 0:32
    a stopping value, and our interval.
  • 0:34 - 0:38
    During each turn, we circle
    our starting value, and every value that is
  • 0:38 - 0:40
    the same number of steps forward as our interval
    value.
  • 0:42 - 0:44
    We stop circling when we get to our stopping value.
  • 0:45 - 0:47
    The person with the highest
    score wins!
  • 0:48 - 0:50
    For loops can come in handy in a lot of places.
  • 0:51 - 0:54
    If you were a
    meteorologist, you would use for loops all the time.
  • 1:03 - 1:11
    Hi, I'm Becky. I work at Able Driller
    Renewables as a wind meteorologist.
  • 1:12 - 1:19
    I forecast wind speeds for the Columbia River Gorge area, where the company owns wind farms.
  • 1:20 - 1:23
    We're trying to understand how much wind is going to be there,
  • 1:24 - 1:27
    so that we know how much power is going to be outputted.
  • 1:27 - 1:31
    We give that information to real time energy traders. They buy and sell power,
  • 1:32 - 1:36
    based on how much power we tell
    them is going to be there, in order to make sure
  • 1:37 - 1:39
    the power grid is balanced, your lights stay on,
  • 1:39 - 1:44
    and that we maximize energy we get out of our wind farms.
  • 1:48 - 1:51
    We're at the national control center for Eber Troller Renewables here in Portland,
  • 1:51 - 1:56
    and this is where we have information coming in from all our farms across the country.
  • 1:58 - 2:03
    Even the highest power computers
    today can't simulate the atmosphere everywhere.
  • 2:04 - 2:11
    In computer forecasting models, we have what
    we call a grid. Each grid point is a latitude,
  • 2:11 - 2:16
    and a longitude. We have to calculate the physics,
  • 2:16 - 2:20
    and try to figure out wind speeds, temperature, pressure, that sort of thing.
  • 2:21 - 2:24
    Since these are fairly big grids and we're doing this in a lot of points,
  • 2:24 - 2:28
    we're looping over these
    things millions and millions of times.
  • 2:29 - 2:36
    Everything I do, I'll use for loops. Here for example
    is a for loop right there.
  • 2:38 - 2:44
    When you're forecasting wind, there's so many different parameters that go into it,
  • 2:44 - 2:49
    that go into it it would be impossible for a human to sit down and do all those calculations.
  • 2:52 - 2:56
    There's so many different aspects to what's going to be affecting the wind
  • 2:56 - 3:00
    that we need a computer model in order to forecast it.
Title:
Unplugged: For Loop Fun
Description:

more » « less
Video Language:
English
Team:
Code.org
Project:
CSF '21-'22
Duration:
03:03

English subtitles

Revisions