April 28, 2025

Week 31 - Block programming with Scratch

CLASS OBJECTIVE

Introduce block-based programming by creating a Scratch account and exploring its key features, such as sprites, stages, events, controls, motion, sounds, appearances, and more.


INTRODUCTION

BLOCK-BASED PROGRAMMING

In this course you learned to program using different programming styles, like flowcharts (Raptor) and a didactic programming language (PseInt). Now you'll be introduced to block-based programming.

Block-based programming is a way of programming that uses visual blocks instead of writing code with text. These blocks fit together like puzzle pieces, making it easier to understand programming logic without needing to memorize syntax. It is very common in educational environments, such as Scratch, Blockly, or App Inventor, because it helps beginners (especially children and young people) learn the basic concepts of programming.

  • Sequences
  • Conditionals
  • Loops
  • Variables
  • Events

Each block represents an instruction or control structure, and by dragging and connecting them, the program is built.


Events

In block-based programming, an event is an action or situation that triggers or activates a block of code. In other words, the program starts executing certain instructions when that event occurs.


Control

These are the blocks that manage the flow of the program. They can easily be compared to traditional programming structures such as decision-making and loops, among others.


Stage and Objects

Programming in Scratch is often compared to animation, whether pre-programmed or interactive with a user. To achieve this, it is necessary to have a background (stage) and objects (sprite) that perform movements, change appearance, or play sounds.


Movement, Sounds, and Looks

These are essentially the actions that objects will perform when the conditions are met, or when the user decides.


Variables

As in any programming environment, the need to store data requires the use of variables, which are memory spaces labeled to store information related to the execution of a program.


Operators

Like variables, mathematical, text, and comparison operators are necessary for the execution of programs. With them, we can analyze and compare numerical information required for the execution of a program, even in a graphical environment.


SCRATCH ACCOUNT

Before you can star using Scratch, you have create an account in the next Web Address.

https://scratch.mit.edu/

Once in, follow the next steps:

  1. Click on the "Join Scratch" button.
  2. Create your user name using your student number, name and second name. 12345JosePerez
  3. Select México from the list.
  4. Add your birth month and year.
  5. Now your gender
  6. Write your school email address. a12345@idec.edu.mx
  7. Validate the process by opening your email account
Now, you're ready to start using Scratch. Use the CREATE menú to start programming.





Now, follow your teacher instructions to create your first program.


CLASS NOTES

As usual, write down the class title, the class objective, and answer the following questions:

  1. What are the differences between the Raptor, PseInt, and Scratch programming styles?
  2. Can you name at least three elements used in Raptor, PseInt, and Scratch?
  3. What is completely new to you in Scratch?

April 01, 2025

Week 28 - Selections and loops 2nd practice

CLASS OBJECTIVE

Reinforce the use of REPETIR and SI_ENTONCES commands by creating a new algorithm in PSeInt, but this time using a flowchart as a visual support. This new algorithm's purpose is to analyze a number to determine whether is a prime number or not.


INTRODUCTION

Today you're going to create a new algorithm to determine prime numbers. You already know the commands and the programming structures, except for the MOD operator, but you'll find it's a very easy mathematic operator related with division.


MOD OPERATOR

You're going to use a new operator, its name is MOD and the symbol that represent it is %

In this case, it doesn't mean "percentage", in this case means REMAINDER of a division.

For our practical purpouses, you must know that every time you get a remainder zero it means you found an exact divisor.

Try the next algorithm in PSeInt:


COMMENTS

This feature could be very helpful to remember how your PseInt algorithms work.  Add comments using double slashes.  

Everything you type after the slashes will be ignored by the interpreter, so you can add as many comments as you need.

// comentarios





ACTIVITY 1 

  • Start naming the algorithm, its name will be Números_primos, without spacesRemember the difference between the algorithm name and the file name, in which you can use spaces. 
  • For the file use the name Student name + números primos.
  • Now, you're going to use the next flowchart to create the algorithm in PSeInt. Remember you have to type commands and operators, or you can click on the left and right panels instead to insert then in the algorithm.




After you finish, press the "play" button to test it. Obviously it must tell you if a given number is prime or not.

Save the file and, before you turn it in,  press the "flowchart" button. Does it look like the image above?



CLASS NOTES

Write down in your notebook the title of the class, the objective and follow the instruction.

  • Write down the algorithm code from PSeInt in your notebook and explain, using your own words, what does every code line do, from the first until the last.

Show your answers to your teacher.