Here you can see that the first section has been completed entirely, and the second one (maze) only partly. Complete as many as you can in the time allowed, and submit screenshots from your computer to your trainer.
After you complete a task, you are shown the equivalent code in a language known as Javascript. This is the code used by web browsers, and is an interpreted language. Python is similar in many ways, with a simpler syntax.
Maze is an introduction to loops and conditionals
Bird is a deep-dive into conditionals
Turtle is a deep-dive into loops. Use nested loops to paint a picture. Later we may use Python Turtle- similar concepts.
Go to blockly games and complete the introduction on moving blocks around.
Complete as many as you can of the Maze tasks
Attempt the Bird Tasks
Attempt the Turtle Tasks
Take screenshots of your progress and upload to the quiz here.
With the developers test environment, you can create similar code blocks but this time, you can also see the corresponding JavaScript AND Python equivalent code. We'll use this later when developing flowcharts and writing the code for those charts. The input statements and the output (print) statements we will use with blocks will get executed (interpreted) by the browser as JavaScript, but we will be able to opt to view the equivalent code in Python, or a selection of other languages.
Just reviewing the various menu items on the left hand side- logic, loops, maths, functions etc. you can see topics that will come up during the course- all of these will be used in the coming weeks, where you will write code using the text rather than dragging blocks and snapping them together. The blocks shown above will be useful to refer to when you have modified or deleted it later on during a skills development task.
Click through each of the menu areas to familiarise yourself with what content is in each section.
Using blocks like the ones shown, and arranging them in different ways, modify or replace the given script to do the following series of tasks, in the suggested order.
On completion of each of the following steps, examine the Python code and make notes on what you see- how does the code "read" compared with the blocks of code you have put together? What is the most confusing thing about the Python code? What is the easiest code to understand? Is there anything that surprises you about the code?
create a new variable user
use a combination of the set and the prompt blocks to ask the user to enter their name using the following message: "Hi, What's your name?" as shown in the example prompt box above.
Create a new variable greeting
use the set and create text with (concatenate) block to join the greeting text "" with the (variable reference) name of the user.
Take note that you may need to add a space to have it render (show/display) correctly. Computers do not know to add spaces to make things easier for us- they work with binary numbers. 01111001 01110101 01110000 is a binary representation of text - later you'll be able to process and "read" this.
Create a new variable first_ltr. This will represent the first letter of the name entered- in our example, this would end up with the variable being set to 'P'.
Look at the block you need to get the first letter- and assign the first letter to the variable first_ltr
Print a message that combines the text "Your name begins with a: " and the variable that is holding that value.
Make sure that all of your blocks are connected in the window and ensure that it runs.
Add a loop to make the code block execute three times, just as the original code block did.
See what happens when you enter:
nothing
a number
your own name
The logic for this last bit can be tricky. We will look at two ways to implement a limited loop. The idea is that, instead of looping a fixed number of times, we loop until a condition is met.
Before the loop body, set the user variable to None, or an empty string.
Implement the loop using one of the methods shown below
The logic here is that, having set the user variable beforehand, we say that:
while the user is not equal to "Danny":
complete the block of code in the body
Here, the block of code loops forever (while true). Inside the loop, we execute all of the code we created earlier, and then, while inside the loop we check
while True:
complete the block of code in the body
if user equals "Danny":
break out of the loop
Complete the following survey to show completion of the tasks above. Use the notes made at each stage to fill the first three questions in the form. You will need to take a snip of the code and blocks for the final version with blocks, and upload this image.