Want to learn how to code? Start here.

Image for post
Image for post

Who is this course for?

Github Repository


Can Anyone Code?

For Each Item on the floor:  
If Item is a piece of clothing:
fold it
throw it away

What Language Should I Learn First?

What is Coding Anyways??

Brief Introduction to How a Computer Works

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
touch hello.c
Image for post
Image for post
Create a new file
#include <stdio.h>  

int main() {
printf("Hello World!\n");
Image for post
Image for post
gcc -S hello.c
.file  "hello-c-world.c"  
.section .rodata
.string "Hello World!"
.globl main
.type main, @function
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $.LC0, %edi
call puts
popq %rbp
.cfi_def_cfa 7, 8
.size main, .-main
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4"
.section .note.GNU-stack,"",@progbits
gcc -o my-first-program hello.c
>@@@x@8  @@@@@@��88@8@@@�� ``08 ((`(`��TT@T@DDP�td��@�@44Q�tdR�td``��/lib64/ld-linux-x86-64.so.2GNUGNUD�;���y��7Ԡ1I�J>" libc.so.6puts__libc_start_main__gmon_start__GLIBC_2.2.5ui   1�`` `(`H��H�  
H��t�;H����5 �% @�% h������%� h������%� h�����1�I��^H��H���PTI���@H��@@H��-@�����fD�G`UH-@`H��H��w]øH��t�]�@`����@`UH-@`H��H��H��H��?H�H��u]úH��t�]H�ƿ@`����=Y uUH���~���]�F ��@H�= t�H��tU� `H����]�{����s���UH���@�����]�AWA��AVI��AUI��ATL�%� UH�-� SL)�1�H��H���m���H��t�L��L��D��A��H��H9�u�H��[]AA]A^A_�ff.���H��H���Hello World!;0,���|l���LY����l�������� zRx ����*zRx �$����@FJ w�?;*3$"D����A�C
K Dd����eB�E�E �E(�H0�H8�M@l8A0A(B BBB�����
print "Hello World"
touch hello.py
print ("Hello, World")
python hello.py

Recap: How a Computer Works

Let’s clone a Github repository!

git clone https://github.com/zachgoll/how-to-code-1-hour-crash-course.git repo
git clone <link> <name>
Image for post
Image for post

Basics of Coding


What is the Command-Line?

Image for post
Image for post
The Command Line
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
"E:\Filesystem Example\Parent Folder\"
cd ~
Image for post
Image for post
cd ~/  
Image for post
Image for post
cd environment# This is a command-line (bash) comment, and doesn't do anything
# I can use these comments to explain things without affecting
# the commands that I am writing
# You can also type the following commands which are equivalent
cd ~/environment
cd /home/ubuntu/environment
~/environment/my-first-program # this is a binary file
Image for post
Image for post
Image for post
Image for post
cd ~/environment# ORcd /home/ubuntu/environment
cd repo/source-code# ORcd ./repo/source-code# ORcd ~/environment/repo/source-code# ORcd /home/ubuntu/environment/repo/source-code
python clean-room.py
Program: clean room program
I put the hoodie in my dresser!
I put the t-shirt in my dresser!
I threw the orange peel in the trash can!
I threw the gum wrapper in the trash can!
python clean-room.py# OR python ./clean-room.py# OR  python /home/ubuntu/environment/repo/source-code/clean-room.py  # ORpython ~/workspace/how-to-code-1-hour-crash-course/source-code/clean-room.py 
<interpreter> <file path>

Absolute vs. Relative Path

cd /home/ubuntu/
# Relative path
# Now replace ./ with the current working directory of /home/ubuntu/# Absolute path
python ./environment/repo/source-code/clean-room.py
# First navigate to the program's directory
cd ./environment/repo/source-code/
# Now run the program with its relative path
python ./clean-room.py

Going up a directory

cd ~/environment/repo/source-code/
cd /home/
cd ../../../../
# Navigate to the ~/environment/repo/ path with the `cd` command  
cd ~/environment/repo/
# Create a new directory to store your code in
mkdir my-code

# Navigate to this new directory
cd my-code/
# Create another directory
mkdir program
# Navigate to this new directory
cd program/

# Create a new file
touch clean-room.py

# Copy the contents of the source file to your new file
cp ~/environment/repo/source-code/clean-room.py ./clean-room.py

# Run your program
python ./clean-room.py
mkdir ./my-code/# ORmkdir ~/environment/repo/my-code/# ORmkdir /home/ubuntu/environment/repo/my-code/

What are arguments?

# Navigate to the directory where the file is saved
cd ~/environment/repo/my-code/program/
# Move the file up one directory
mv clean-room.py ../
# Move up one directory to where the file has moved to
cd ../
# Delete the old directory that now has zero files in it
rm -rf program/
cd ~/environment/repo/my-code/  
rm clean-room.py
CP(1)                     BSD General Commands Manual                    CP(1)  

cp -- copy files

cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ...

In the first synopsis form, the cp utility copies the contents of the
source_file to the target_file. In the second synopsis form, the con-
tents of each named source_file is copied to the destination
target_directory. The names of the files themselves are not changed. If
cp detects an attempt to copy a file to itself, the copy will fail.

The following options are available:

-a Same as -pPR options. Preserves structure and attributes of files
but not directory structure.

-f If the destination file cannot be opened, remove it and create a


Data Types

Data Types
# These are valid variable declarations   
my_variable = 200
myVariable = 200
MyVariable = 200

# These are invalid variable declarations
my variable = 200
"my variable" = 200
my_custom_variable = 10


number_of_links = 0  

for each tweet in all_tweets:
if tweet has hyperlink:
number_of_links = number_of_links + 1

for item in items_in_room:  
# Print the item
items_in_room.forEach((item) => {  
for (let i = 0; i < items_in_room.length; i++){  

If-Then Statements

# At the top of the file, we create a single variable that we can
# set to true to enable "debug" mode
# or to false to disable "debug" mode
debug = True

my_array = [104, 32, 63]

for item in my_array:
if debug:
print("Original value: " + str(item) + " New value: " + str(item * 2))
print(item * 2)
Original value: 104 New value: 208  
Original value: 32 New value: 64
Original value: 63 New value: 126


var1 = 100   
var2 = 150

if var1 is var2:
print("They are equal!")

if var1 is not var2:
print("They are not equal")
let var1 = 100  
let var2 = 150

if (var1 === var2) {
console.log("They are equal!");

if (var1 !== var2) {
console.log("They are not equal");
Image for post
Image for post
The Python shell allows you to write Python code
# Math operators   
2 + 2
5 - 3
4 * 8
9 / 3
8 % 4

# Comparison operators - if they evaluate to true, they will print True, if not, they will print False
2 is 2
2 is not 5

# Comparison operators - python also allows the traditional operators used in most languages.
# These are the same operators as the ones used above
2 == 2
2 != 5

# Comparison operators - all the rest
2 > 1
2 >= 2
6 < 7
6 <= 7
2 <> 5 # another way to express "not equal"

# Other operators
2 == 2 and 3 == 3
2 == 2 or 3 == 5

# Increment and decrement
my_var = 2
print(my_var) # 2

my_var += 1
print(my_var) # 3

my_var -= 1
print(my_var) # 2
If-then statement written with various operators (same result in each)


def add_two_numbers(first_number, second_number):  
return first_number + second_number
add_two_numbers(1, 1)


# This command will print all of the past changes to the project  
git log --oneline

# Example output from the command above might look like:
# 6fda0da I broke the project in this commit!
# f2f170b Some routine bug fix
# 6d54702 Add login functionality

git checkout f2f170b
Image for post
Image for post
cd ~/environment/repo/  
touch learn-git.txt
git remote -v    

git status
Image for post
Image for post
git add learn-git.txt  

# We could also run the following command to add ALL files
git add .
Image for post
Image for post
git commit -s -m "Add my files to the remote repository on Github!"
Image for post
Image for post
git config --global user.name "Your Name"
git config --global user.email you@example.com
git push origin master
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
git pull origin master
Image for post
Image for post

What is a Coding Environment?

Local Environment

Hosted/VPS Environment

Virtual Machine/Containerized Environment

Types of Coding

Web / App Developer

Networking Engineer / Systems Engineer / Security Engineer

Data Scientist / AI / Deep Learning


Resources and Next steps


Written by

I write software tutorials and golf software

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store