Wednesday, November 14, 2018

Introduction

Hello! Welcome to Coding for the Young Ones!

This blog is to teach the basic principles of programming and Computer Science, specifically targeted to the younger generation (the young ones).

We plan to educate the youth starting with basic ideas like typing and problem solving to actual coding using Python and other languages.




How to Type

Let us begin with the essentials, typing.

Typing is an important skill that every young one should know. 
If you use any computer, then typing is a required skill.


Posture:  For proper typing style, please keep your back straight with feet on the ground.

Eyes:  In order to properly type efficiently, please keep your eyes on the screen. 
           ( Try to avoid looking at your keyboard while you are typing. )


Fingers:  Before typing, your fingers will begin on the "Home Row" and will designate certain 
              keys to certain fingers. See figure below.
         

                                                             
                       Image Source: http://www.atypingtest.com/homerowkeys/home-row-keys.html 


Here is a video of my typing that you can strive to be like!: 





If you would like to practice typing, here are some of the websites that I would recommend: 

       Beginner Level: 
              Dance Mat Typing: https://www.bbc.com/bitesize/articles/z3c6tfr  
                  = This is an interactive step-by-step typing experience.
                     (This is also what I used to learn typing in elementary school.)

       Intermediate Level: 
               TypingTest: https://www.typingtest.com/
                  = This is a casual typing challenge where you can test how fast & well you can type.

       Advanced Level:
             TypeRacer: https://play.typeracer.com/
                  = This is a competitive typing game where you can challenge others at typing.




Basic Programming with Scratch

Why Start with Scratch? (https://scratch.mit.edu/)

Scratch is a good beginner programming language that is basically a puzzle.
There are a lots of blocks that can be attached to one another to make a program.
For example, there are blocks for waiting, looping, animating, sound, and interactions.
















Within Scratch, you can also add your own drawings and pictures and give separate movements to each one.

Here is an example where I do some basic Scratch programming: 





There are lots of various other projects available to test at https://scratch.mit.edu/explore/projects/all

To find my Scratch projects visit: 
https://scratch.mit.edu/users/coding4theyoungones/

Tuesday, November 13, 2018

Python Basics

Python

Before beginning with Python, you guys must download it via: https://www.python.org/downloads/

After you have finished downloading Python, open the IDLE to begin coding in Python.

  
INPUTTING AND OUTPUTTING
Let's start with the beginning, getting inputs and outputs.

The basic input function is input().
You could put in a prompt/question to ask before getting input within the parenthesis.
For example, input("What's your name"). The user will see this question and know what input the computer is asking for.
The basic output function is print(). 
Within the parenthesis, you put what you want to be printed out to screen. 




Let's break down that example some more!

We used the term "input", "output" and "function" but what does that mean?
An "input" refers to anything you would type to the computer and an "output" is what the computer will display.
In the example the output would be "What's your name" and the input would be the name you typed.

Lastly, a "function" is code that someone has already written and ready to use. Functions are important because they save us a lot of time. Instead of having to write code so that we can have the computer show the words "What's your name" we do a function call - i.e. use a function by typing it's name. Throughout our examples we will provide the function names to use but it is always a good idea to look up more functions because they always provide something useful.

Monday, November 12, 2018

Variables

Let's talk about another useful tool for programming!

This tool is called a "variable"

A variable is a way to save information that you want to use for later.
Let's look at the above example again, we wrote a program that asked "What's your name?" but we never saved it to a variable. If you try to ask the computer to tell you your name it will not be able remember it. To solve this we can write the same code but using variables!

A variable is very easy to make all you need is one of these " = ". The = sign will create the variable for you as long as you put things in the right order.

Here is the order:
Name of the variable = information you want to be saved

Example:
apple_color = "red".

Now let's rewrite the pervious example this time using this web site
https://repl.it/repls/BowedDiscreteCodegeneration

You can make as many variables as you want but there are some important rules to keep in mind.
1. The variable name never goes inside of  " " quotation marks
2. The variable can be numbers, words, even other variables
2. If you want to save a word or sentence that you then that information must go inside of " " quotation marks

If Statements

Our next programming tool is what is called an "if statement".

Let's first learn how it works!

Let's say there are two snacks I want to buy at a store. They both cost $3 but I don't know how much money I have in my pocket yet. I need to check how much money I have before I can decide what to buy. Here is where the logic of an "if statement" comes in:

If I have $6 or more then I can buy both the snacks, if I have more than $3 but less than $6 I can only buy one snack, else if I have less than $3 I can't by any snacks.

Let's take a look at how we can right the above "if statement" in python!

Time to break down the above example!
We start with a variable "Money_in_pocket" and set it equal to 5, this is used to represent how much money we have.
We then write our first "if statement";
- if Money_in_pocket >= 6:

This is the way to write an in statement in python. Start with the key word "if" followed by a "condition" that will be either true or false. The ">=" means greater than or equal to. In English what are statement is saying is "if Money_in_pocket is greater than or equal to 6". Notice that we end it with a ":", it is important to remember that statements like this always have to end with ":" or you will get an error.

Now the line under our first if statement reads; 
- print("I can buy both snacks!")
This is what would show if our if statement comes out to be true, but since Money_in_pocket is not greater than or equal to 6 because we set it to 5, we could not buy both snacks.

The next line is also a part of the "if statement" tool:
- elif Money_in_pocket >= 3 and Money_in_pocket < 6:
The key word "elif" is short for else if, simply another if statement. The difference is that elif always comes after an initial if statement. 
There is another key word here "and". When we use "and" it means that we have two or more conditions that must be true for the statement below to happen. 

Lastly, we have the key word "else", this key word comes after an "if" or "elif" statement. It is meant to catch anything that does not meet the previous statements.  It makes it easier for us as programmers because we don't have to write all possibilities and we can focus on the ones that matter. 


Introduction

Hello! Welcome to Coding for the Young Ones! This blog is to teach the basic principles of programming and Computer Science, specifically ...