In this coding course for kids, your kids will learn how to get started with coding using any programming language, this coding exercise is designed for kids of age group 5 to 10 years old, and here every example is demonstrated using two popular programming languages JavaScript and Python.
Before you start writing any programming syntax, you need to install respective software development kits often termed as SDK in your local computer.
Please download and install Visual Studio Code (you can use any other SDK). VSCode will allow you to write code in both programming language.
If you are learning coding for the first time, then I recommend you start with JavaScript only, easy to start, no additional installation required.
How to create file?
For each programming language there are different type of SDK, in some programming language we can write code in simple notepad, then save them with different extensions.
Here we have given example in JavaScript and Python; you can start with either one, or if comfortable, start with both simultaneously.
Create a file in visual studio, save the file with .js
extension, the file will be a javascript file
which will accept only javascript syntax.
You can also write JavaScript code in htm / html file using script block like <script></script>
learn more about Javascript coding.
Create a file in visual studio, save the file with .py
extension, the file will be a python file
which will accept only python syntax.
You also can write python code in html page, which can be served on browser with different extension based on what framework you are using, learn more about python programming.
How to write “Hello World” ?
Write the following line in .js file and run the code in VSCode
var name="Arnold"; console.write("Hello World, I am "+ name);
Write the following line in .py file and run the code in VSCode
name="Arnold"; print("Hello World, I am "+ name);
How to define a variable and assign value ?
Variable is a temporary storage for holding values within the program, variable can be of different type like string, integer, date etc. (differ in different programming language).
variableName=value;
var count=10; //or let count=10;
count=10; #or siteName = "WebTrainingRoom";
How to define a collection variable (known as array)?
Collection variable is useful when you want to keep a collection of values in one variable, like a team (all player in one team), class room (all students in one class) etc.
const players = ["Ajay", "Akshay", "Amir","Monoj","Ravi"];
//or var players = new Array(); players[0]="Ajay"; players[1]="Akshay"; players[2]="Amir";
Learn more about JavaScript Array
array1 = [0,1,2,3,4,5,6,7,8,9] print(array1) #or array2 = [0 for i in range(5)] print(array2) [0, 0, 0, 0, 0]
Learn more about Python Array
What is loop? how to work with loop?
Loop is an object structure that runs continuously until all elements are processed, it executes same step again and again repeatedly, till the last element is executed.
For example, we want to display name of all the players in a team, in such situation, we loop through the collection variable where all team members are stored.
var players = ["Ajay", "Akshay", "Amir","Monoj","Ravi"];
for(i=0;i<=players.length;i++) { console.writeline(players[i]); }
Learn more about JavaScript Loops
players = ["Ajay", "Akshay", "Amir","Monoj","Ravi"]; for p in players: print(p)
Learn more about Python Loops
More Coding Tutorial for Kids: