Activa JavaScript para disfrutar de los vídeos de la Mediateca.
tpr2_u1_programming_video - Contenido educativo
Ajuste de pantallaEl ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:
Hi, let's take a test on programming, how programs work.
00:00:00
So, this animation shows a program, yes, not a flowchart, and a program running.
00:00:08
It's a program, but in this case the program is running.
00:00:15
Okay, each block of this program represents two answers, a step, a step on the process, yes,
00:00:21
an instruction, yes, instructions in the program
00:00:28
it's not a process, algorithm or flowchart
00:00:31
ok, the same program
00:00:35
two answers, in this program
00:00:41
what the program does is to draw a square, a simple
00:00:44
square, the user doesn't enter anything
00:00:49
because everything is here, internally
00:00:52
in the program, let's see, so there is no input
00:00:57
data, yes, the user enters, the user
00:01:01
doesn't enter anything, there is no output, there is an output, a square
00:01:05
there is no end, yes, we have here the stop
00:01:09
and the output is a square, good, the output we said
00:01:12
is a square and the length of each
00:01:21
side is 200 steps
00:01:24
okay so it's a 200 by 200 step square
00:01:27
and instead of a square if we want to draw a rectangle
00:01:34
we need to change something
00:01:40
we need to change not the first move 200 steps
00:01:42
but the second one instead of 200, 300
00:01:48
so we need to change two blocks
00:01:51
move 200, 2 move 300. Odd and even numbers. Odd numbers are 1, 3, 5, 7. Even numbers are 2, 4, 6, 8.
00:01:57
Okay, have a look at the program and if the user enters number 1, the output has to say,
00:02:16
the output has to be
00:02:23
1 is an even or odd number
00:02:26
we said odd numbers are 1, 3, 5
00:02:30
so the output has to be
00:02:33
1 is an odd number
00:02:36
1 is an even, 1 is an odd number
00:02:38
the same, but instead of 1, 4
00:02:43
4 is an even number
00:02:48
2, 4, 6
00:02:50
so 4 is an even number
00:02:52
the same, have a look
00:02:58
and when the user enters number 3, that is a not number
00:03:01
the repeat until block is repeated
00:03:07
repeat until block, this is the repeat until block
00:03:10
this block, ok, so when we enter
00:03:15
number 3, okay, n is 3, so, is not 0, no, minus 1, so, no, no, and now n is 3, minus 2, is 1, and go back, here, go back, is n, now is 1,
00:03:20
0, minus 1, minus 1, no, so no, no, that is the second time we are doing this
00:03:43
and n now is 1, minus 2, that is minus 1
00:03:53
so n goes back again, and now n is minus 1
00:04:00
so we stop, we don't have to do this
00:04:05
So how many times did the program run this loop?
00:04:09
Two times, twice
00:04:16
Two times
00:04:18
Now we enter number 6
00:04:21
Let's see
00:04:27
n is number 6
00:04:28
No one of these
00:04:31
So no, no, no, no
00:04:33
One time
00:04:36
6 minus 2 is 4
00:04:37
And back
00:04:40
Now, no, no, no, no, no, second time
00:04:40
4 minus 2 is 2, and back
00:04:44
No, so no, no, no, no, no, that is the third time
00:04:48
2 minus 2 is 0, go back
00:04:53
When n is 0, we don't repeat again, so 3 times
00:04:57
We repeat the sequence 3 times
00:05:01
Comparing numbers
00:05:05
So, in this program the inputs, the inputs is what the user enters, and what the user enters is number 1, enter number 1, and enter number 2. Number 1, number 2, the variables. So, number 1 and number 2.
00:05:11
Possible outputs for this, so we compare two numbers
00:05:34
and the output is what the program shows
00:05:38
and the program says, okay
00:05:42
number one is less than number two, or they are the same number, they are equal
00:05:45
or number one is greater
00:05:50
than number two, these are the three possible outputs
00:05:53
less than
00:05:59
the same number, and greater than
00:06:02
we are using the same program
00:06:06
the user enters 3 and 7, number 1 is 3
00:06:16
number 2 is 7, and the inputs are
00:06:20
they are the same number, here we have a problem
00:06:24
because the inputs are 3 and 7
00:06:30
no, this one
00:06:34
comparing the same program and now the output
00:06:43
and we say that the inputs are number 3 and 7
00:06:47
so 3 is less than 7, do we have this?
00:06:51
yes, 3 is less than 7, so this one
00:06:54
loops, this is a loop, a repeated sequence
00:06:58
ok, this program draws, ok, if we repeat 4 times
00:07:08
move 150 and we turn 90 degrees
00:07:13
four times what we draw is a square a square 150 step square 150 by 150 steps
00:07:16
square the same loop select extraction would you would change to draw now not
00:07:33
150 but 90 by 90 so there we need to repeat four times and we need to turn
00:07:44
90 degrees the only instruction we need to change is move 150 and now we draw a
00:07:51
rectangle sorry a triangle and we need to select two instructions so for a
00:08:06
a triangle we need to repeat not four times but three so this is one of them
00:08:12
and the triangle is 150 the same as this but instead of turning 90 degrees we
00:08:18
need to turn 60 degrees but we need to change this this one odd numbers list a
00:08:26
a list of odd numbers, so the variables n and odd are, let's see
00:08:40
set n to 10 and odd to 1 is one
00:08:46
action that the program internally
00:08:52
does, so the user
00:08:56
doesn't enter these numbers, so they are internal
00:09:00
variables, not input, not output, internal
00:09:04
Have a look, variable n is used to end, n initially is 10, and the loop is from repeat until n is 0
00:09:11
and what we do is to create a list of 10 odd numbers, it says that
00:09:27
So what is n? The number of the quantity of numbers the program shows, odd numbers, the quantity. They control the numbers of time, the process is repeated, good, store odd numbers, no, store even numbers, no, store the number the user enters.
00:09:34
the user doesn't enter anything, so it has to be this
00:09:58
and odd, as we said here
00:10:02
the 10 odd numbers, the first value for
00:10:06
odd is 1, and look
00:10:10
odd here is 1 plus 2
00:10:14
3, the second number, and later on, odd is
00:10:18
3 plus 2, 5, 5 plus
00:10:23
2, 7, 7 plus 2, 9, so
00:10:26
odd is the variable that stores the odd numbers
00:10:30
ok, when n is 8
00:10:35
odd is, let's see, when n is
00:10:42
10, odd, the first odd number
00:10:46
is 1, so let's see how it works
00:10:49
and the first time we go through these
00:10:53
loop is n is 10 minus 1 is 9
00:10:58
and odd is 1 plus 2 is 3, 9
00:11:02
3, again repeat, now is
00:11:06
9 minus 1 is 8 and odd is
00:11:10
3 plus 2 is 5, when n is 8
00:11:14
odd is 5, and we finish
00:11:18
excellent, thank you
00:11:25
- Subido por:
- Maximino R.
- Licencia:
- Reconocimiento - Compartir igual
- Visualizaciones:
- 137
- Fecha:
- 10 de enero de 2021 - 11:44
- Visibilidad:
- Público
- Centro:
- IES ALFREDO KRAUS
- Duración:
- 11′ 34″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 31.68 MBytes