replit

Before you start this course, you must login to Replit

If you have forgotten your Replit account user name or password, ask your Coder Coach.

CodeSports

2-3-Modify 01

Variable Assignment:

Students learn how to use the = operator to assign data into variables. Students can refer to the lesson plan to learn the goals and objectives of this unit, get a preview of the material taught in the unit, and learn new software defenitions.

Instructions:

Adapt the code so that:

  • Two more varaibles will be declared. These variables should store the names ‘Duff’ and ‘Izzy’
  • The two new variables will be printed on line 15

Learning Objectives/Goals

Students will learn to interpret, trace, identify and create python code that uses:

Concept Explanation Python Code Examples
Strings The text data type. All string data is treated as text, even if it is numerical characters. “string goes here” “This is a string”
Variable assignment Putting data into a variable. = num1 = 10 name = “Andy”
Concatenation Joining string literals (text in speech marks that prints exactly as it appears in the code) to the contents of variables in output, or joining the contents of variables together. There are several ways of doing this, but I’ve used the plus symbol in my exercises. + print(“Hello ” + name) full_name = first_name + last_name

In this unit you will learn about:

  • Variable assignment – Using the ‘=’ symbol to store data in a variable. You can find out more about variable assigment here

  • Concatenation – joining the contents of variables to other variables and/or strings in output. You can find out more about concantenation here

Help! My Code Does Not Work!

Look for the following things:

  • No two variables can have the same name.
  • Variable names should be meaningful. (The variable’s name must describe the information the variable holds)
  • Variable names start with a lowercase letter. (ex. ✔num, ❌Num)
  • Variable names cannot contain spaces. (ex. ✔num1, ❌num 1)
  • If a variable name is more than one word long, underscore (use _) the ‘space’ between each word, this is known as snake case:
    • this_is_an_example_of_a_snake_case_variable

Hints