Course Content
Week 1: Getting Started
In week 1 the basis goal is to get started with the basics.
0/2
Week 2: Variables & Data Types
Variables are containers that computer programs use to store information pertinent to what that computer program will do. Data Types are the different types of Variables and how Python uses these variables when building logic
0/2
Week 3: Making Decisions
In both computer programs and the AI world, computer programs need a way to make decisions. Booleans and Conditionals provide a way to make this happen.
0/2
learning Python Programming and also Intro to Games

Lesson 3: Variables and Strings

Topics Covered:

  • Declaring and using variables
  • Working with text using strings
  • Basic string operations and concatenation

What is a Variable?

A variable stores information that your program can use later. You can think of it as a box with a label.

name = "Alex"
age = 12

Using Strings

A string is any text inside quotation marks. You can use single (') or double (") quotes:

greeting = "Hello"
nickname = 'Buddy'

Combining Strings

You can combine strings using the + operator:

name = "Alex"
print("Hello, " + name + "!")

Activity: Build a Sentence

Ask for a user’s name and favorite food, then print a custom message:

name = input("What is your name? ")
food = input("What is your favorite food? ")
print(name + " loves to eat " + food + ".")

Challenge

  • Ask the user for their favorite