The Basics
Learning map and outcomes
In this lesson, students will:
- Learn how to concatenate data for output
- Learn how to store data in variables
- Put these together to make a very basic weather application
The Basics
For more on setting up and choosing a language, see Setting Up.
The following videos provide the basics for using general-purpose programming languages.
Concatenation
This video discusses the process of combining data together to form a coherent output.
Variables
Variables are like labelled containers for storing data. View the ‘Variables' video to learn more about how to create and use variables in your computer program.
Have students practise using variables. Interpret the following pseudocode and code it in Scratch and either Python or Javascript. Students should predict the output of the program (what it will display) before doing their code. Solution code is provided for checking.
Students may work at vastly different paces when doing general-purpose programming, and some may seem to be quicker at spotting problems than others.
Try these strategies with your students:
- Cheat sheets bring together the most basic Python commands or JavaScript commands. See Resources at the bottom of this page.
- Pedantic computer: Think of the computer as a really pedantic person. It usually won’t cooperate if important punctuation (syntax) is missing, if something is spelled differently in two places, or even with the wrong upper or lower case.
- Pair programming or ‘Ask three before me: Often it just takes a fresh pair of eyes to spot errors or bugs in a program. Before asking the teacher the student checks with other students.
- Trace errors: The computer always runs the program in order, line-by-line, according to the code. Study each line one-by-one and ask, ‘What does this line do?’ Consider writing down the values of variables as you go.
- Tinker: Encourage students to tinker with the code. Ask, ‘What would happen if I changed this?’ Alter a part of the code or add a new feature, predict what might happen, and run it to see. You can always put it back again if something goes wrong.
About input/ output
This video encourages users to build a simple weather application to consolidate knowledge learnt so far.
BEGIN a ← 50 Display a b ← 23 Display b c ← a + b Display c END
Solution Code
Resources
- Setting up online environments
- Online environments for coding in each language
- Cheat sheets listing basic commands for coding:
- Python Cheatsheet (from Grok Learning)
- JavaScript CheatSheet (Tip: Press the little blue tabs to move Variables, Basics, Strings and Data Types to the top.)