Robot on Wheels

Code world 101

Coding is the art of using robots to solve problems.

Today we are going to train computers to do our bidding!

What can code do?

Code has impacted our world so heavily, that it's difficult to remember what it was like without them.

Let's take a look at what the world looked like before code.

A world long forgotten...

Twenty years ago, magazines were all the rage. And it was wonderful!

Whether you liked gardening, video games, or celebrity gossip, the industry's best editors and writers would write fresh content and mail it to you every month. 

It was the best way to get the latest news and updates.

Until the internet came and destroyed the industry...

How to use code to engineer addiction

The internet solved the problem of distributing data. Now we can blast a message to the universe from anywhere in the world. 

We don't need writers to create content.

The world will write for us.

We don't need editors to cultivate the best content.

The world will edit for us.

Social media tracks every behavior as users watch recommended videos. Then, with the information the app tracks, it maps out your personality — highlighting emotions such as sadness, happiness, and apprehension and other hobbies.

They use this information to cultivate an endless stream of content that you want to look at. Something human beings would never be able to do.

Achievement unlocked: Coders have engineered addiction. 

With great power comes great...

Computers have become so powerful that people have begun to question its ethics. 

  • Are algorithms manipulating the masses?

  • Are algorithms too effective? Meaning, are we stuck in an echo chamber?

  • Is social media causing depression?

  • Should AI be allowed to generate hate speech? 

Code has become so powerful, that we can no longer just ask if we "could", we need to ask if we "should". These questions are what the coders of tomorrow must struggle with. 

Note: The Spiderman statue on the right does not exist. That picture was generated by AI using the prompt "Spiderman in Ancient Rome".

 

Why learn coding?

The power to change the world is why companies are desperate for coders. Once you cross a certain threshold, you don't look for jobs, the jobs look for you.

Here are just some of the benefits to coding:

  1. Good pay

  2. Work Remotely

  3. Free snacks/food

  4. Not physical. Easier on the body.

  5. Travel

  6. Don't like a software? Make your own. 

magazine.webp
tiktok.webp
spiderman.webp

Origins. The Ancient Roman statue that influenced Stan Lee to create Spiderman.

airbnb_san_francisco_5.jpg

Airbnb HQ. Imagine working here.

Coding fundamentals

When it comes to writing code, there are 4 basic lines of code.

  1. Statements

  2. Variables

  3. Conditions.

  4. Loops

Today we are going to learn the first 2.

karate_edited.jpg

The coder's weapon

 

IDEs are like Microsoft Word for coders. It's what we use to write code. Today we are going to use Replit.

If you did not create an account yet, do that now.

v81htft8liz51.jpg.webp

Replit Live Demo

  1. How to create a Replit.

  2. How executing a program is like double-clicking an app.

Step #1: It speaks!

We want computers to do work for us, but we have to start small.

Like a monkey on his first step in evolution, the first thing we need to do is get computers to talk. 

stoneman.png

Exercise #1

  1. Copy and paste this code into your Replit.
    print('Hello, world!')

    The text in between the quotations is what gets printed! This data type is called a String.

    [Definition]  String - text in a series of characters

  2. Add the second line of code to your page. This shows you how we add code line by line.
    print('Hello, world!')
    print('Hello!')

  3. Your turn! So far we got the computer to print 2 lines of text.
    Hello, world!
    Hello!

    Now add the 3rd!
    Hello, world!
    Hello!
    Goodbye!

  4. Print a fish!
    ><>

Step #2: Creating memory

Now that our computers can talk to us, we need them to remember stuff. Hope you remember your algebra math, because we using variables!

Disclaimer: Don't worry if you aren't good in math. Despite the myth, you don't need to be good at math to do coding. You only need to know the basics.

Student Learning Mathematics

Exercise #2

  1. Copy and paste this code into your Replit. The code below has two print() statements. One where "name" has quotes around it and one that doesn't. 

    Predict what each print() statement will display.
    name = "Michael Jackson" 
    print(name)
    print("name")


    Answer: When there's no quotation marks, then we are printing a variable. For the code above, that is the String "Michael Jackson". When there are quotation marks, we are literally printing the word "name".

  2. Now, we are going to work with numbers. Copy and paste this code into your Replit.
    goals = 24
    print(goals)


    Notice with numbers, we don't have quotation marks around it. Quotation marks are for Strings. Numbers don't need it.

  3. Fix the bug! Why doesn't this code work? Answer is below:
    points = 24
    print(Points)

    Answer: Variable names are case-sensitive. They need to match exactly! Update the code so that it works!

  4. Paste this code into Replit. Print the variable points to see the total. Answer is below:
    goals = 42
    assists = 13
    points = goals + assists


    Answer: To print variable points, add the last line.
    goals = 42
    assists = 13
    points = goals + assists
    print(points)

  5. We can even use variables to combine Strings! Print the variable compound_word.
    first_word = "black"
    second_word = "board"
    compound_word = first_word + second_word

  6. Add these two words together. It should print "greenhouse".
    first_word = "green"
    second_word = "house"

  7. Calculate how many days in 12 years. It should print 4380.
    year = 12

  8. Calculate how many inches in 5 feet. It should print 60.

  9. Fix the bug! Help us fix this code so that it prints 3.375.
    distance_to_vegas = 270
    average_speed = 80
    total_time = distance / speed

    print(total_tme)

  10. Extra credit: Starting from the code below, calculate how many hours are in 12 years. It should print 105120.
    years = 12