Tuesday, June 15, 2021

Chapter 2: How to I start programming?

There are many programming language out there but we will only focus on Python as it is easy to learn and follow.


For Parents

You will need to setup the computer for your child by installing Python. Below are 2 videos which shows how you can install Python and Jupyter Notebook on your Computer. 






In case you missed it, to start Jupyter Notebook, you need to start the server by the command "jupyter notebook" in Command Prompt (CMD). Once you startup Jupyter Notebook, create your first  notebook by clicking on "new"->"Python 3"





As usual the first attempt at programming is the "Hello World" program and it can be done by the code:

print("Hello World")

To execute this code, press the "Run" button or "Ctrl"+"Enter". You will see the printout below.


For Children
Now that your parents has done up the setup, it is time to have some fun with programming. 
Try to print some other stuff such as:

print("Once, there was a boy who became bored when he watched over the village sheep grazing on the hillside.")
print("To entertain himself, he sang out, “Wolf! Wolf! The wolf is chasing the sheep!”")


This "print" function allows the computer to printout a text. Have you notice some other characteristics of the "print" function? 
- each print will output exactly one line
- the text that goes into the print is the "Input" of the program.
- the text that got printed is the "Output" of the program. 
- the text does not change, it is the same text each time you Run the program

You must be wondering, how then can I make the text change in different Run?
The function "input" will help address this. Try the below and the program will ask you to enter a value.

In this case, the function "input" also returns a value and it is stored in the variable, val.

val = input("Enter a input")

This val will then have the value you entered and can be printed using:

print(val)




Do note that the values between the quote "" are known as Strings. This is 1 of the datatype we commonly use in Python. We also have Integers (1,2,3,4,...) , Float (e.g. 1.1, 3.5, 4.666666).

Have fun till the next chapter!


Saturday, April 3, 2021

Chapter 1: Introduction to Computer Programming

We uses computer everyday and they come in different shape and sizes. The following video introduces what a computer do.


After watching the above video, can you name a few devices that is also a computer?


Typical computers has input and output. 

Input are data/information provided to a computer, typically they are 

    - Keyboard



    



- Mouse







After reading the input provided, the computer generate Output, typically they are shown in 

    - Display

  

But there are also other smaller computers, can you name the input and output of the following devices:

1) Mobile devices such as iPad, mobile phones

2) Washing Machine

3) TV


Did you notice that with input, the computer is smart enough to generate a corresponding output? Programming allows a computer to generate these input and this course will teach you how they are generated.