top of page

Code world

Computers are great at remembering data. 


What if we could train them to make decisions?

What we are doing today

Last class, we worked with the basic building blocks of coding, variables. By doing so, we were able to make calculations and store data.

First we made computers speak.

Then we taught it to remember things. 


Now we're going to teach it to make decisions.

Chess Game

Exercises: Casting Integers to Strings

  1. Copy and paste this code into your Replit.

    my_wallet = 14
    print("I have $" + my_wallet + " in my wallet.")

    You should get an error that looks something like this:
    TypeError: can only concatenate str (not "int") to str

    We can't add integers to strings! To fix this, we need to cast our integer to a string.

    my_wallet = 14
    print("I have $" + str(my_wallet) + " in my wallet.")


  2. Miles calculator. Calculate how many miles we got left in the tank.
    * Green highlight signals to use 
    input() to ask user for input.

    Gallons left in tank: 7
    Miles per gallon: 25
    You have 
    175 miles left in the tank.

  3. Traffic ticket counter. Calculate how often you get tickets.

    How many times have you been pulled over: 2 
    How long have you been driving (years): 12
    You get pulled over every 6 years.

How computers make decisions

Depending on...

  • Who your friends are

  • Where you live

  • What you like to read

Social media serves you different content!


How do computers make decisions like this? This is where we make contact with the bedrock of computer languages, the if statement.


Exercises: IF statement

  1. Run this code in your Replit.
    eggs = 4
    if eggs < 6:
         print("Supply eggs-hausted!")
         print("Only " + str(eggs) + " left.")

    print("Inventory check complete.")

    Notice what gets printed.

  2. Update the first line of code and run it.

    eggs = 12
    if eggs < 6:
         print("Supply eggs-hausted!")
         print("Only " + str(eggs) + " left.")

    print("Inventory check complete.")

    What happened??

    Since the if statement is no longer true (e.g. eggs < 6), the indented code block does not run. We use indentations to signal what code blocks should be run when the if statement is true. 

  3. Fix the bug! The code below doesn't work. 

    temperature = input("Current temp: ")
    if temperature < int(60):

    Fix the problem so that it does this:
    Current temp: 32

  4. Water inventory check. Ask users how many bottles of water they have. If they have less than 5, tell them they need to tap up.

    * Test both scenarios (2 bottles and 6 bottles). The output should differ!

    How many bottles of water? 2
    Refill bottles!
    Water inventory checked.


    How many bottles of water? 6
    Water inventory checked.


  5. Fix the bug! The code below doesn't work. 

    savings = input("How much savings you got? ")
    if savings < 10
    print("need mo money!")

Expanding the conditions

We mastered the ability to run code if a certain condition is met.


Now we are going to learn how to make infinite conditions!


Exercises: Else Statements

  1. Run this code.

    eggs = 3
    if eggs < 6:
         print("Supply eggs-hausted!")
         print("Only " + str(eggs) + " left.")
         print("You egghead!! We got too many eggs!!")

    print("Inventory check complete.")


    1. eggs = 3​

    2. eggs = 12

    3. == Condition

  2. Water inventory check v2. Add message when there's enough water. Your app should be able to handle 2 different conditions. 

    1. ​If less than 3 bottles, ask user to "Refill bottles!"

    2. If user has 3 or more bottles, tell the user "Bottle supply is good!"

      How many bottles of water? 2
      Refill bottles!
      Water inventory checked.


      How many bottles of water? 6
      Bottle supply is good!
      Water inventory checked.

Last class in the series.
Beginning of a new journey

Do you understand how powerful coding can be? If you learned this much in 3 classes, imagine what you can do after completing the program. 

That's why if you enjoyed this class, you have to book a free class today.


Listen to our students' words after completing our program.

"Before I knew how to code, I didn't have any options. Now that I know how to code, I have too many!"

- Sarah (Marketer)

"I just got the offer from Epic Games (Fortnite and Gears of War)!! They actually offered me more than what I was asking, because they thought I might've been a little too overqualified, which is INSANE lol."

- Joseph (Salesman)

Coding transforms lives.



Next Meetup class

Most new coders have a difficult time breaking into the industry because they don't understand what employers want.

That's why on Wednesday, October 26th at 7pm, we are going to take a look at the job market from the employer's perspective. Once you understand what they want, you can create a portfolio that they can't help but hire you.

Thank you for joining us! 

Countryside Road
bottom of page