• Home
  • Python
    • Introduction to Python
    • Python Developer
    • Expert Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
    • Expert JavaScript Developer
  • React.js
    • Introduction to React
    • React Developer
    • Expert React Developer
  • Linux
    • CyberSecurity - Introduction to Linux
    • CyberSecurity - Linux Administrator
    • CyberSecurity - Expert Linux Administrator
  • Active Directory
    • CyberSecurity - Introduction to Active Directory
    • CyberSecurity - Active Directory Administrator
    • CyberSecurity - Expert Active Directory Administrator
  • Interactive Training
  • Pricing
  • Brainstorm
STEMTrainingGrounds
  • Courses
    • Home
    • Python
      • Introduction to Python
      • Python Developer
      • Expert Python Developer
    • JavaScript
      • Introduction to JavaScript
      • JavaScript Developer
      • Expert JavaScript Developer
    • React
      • Introduction to React
      • React Developer
      • Expert React Developer
    • Linux
      • CyberSecurity - Introduction to Linux
      • CyberSecurity - Linux Administrator
      • CyberSecurity - Expert Linux Administrator
    • Active Directory
      • CyberSecurity - Introduction to Active Directory
      • CyberSecurity - Active Directory Administrator
      • CyberSecurity - Expert Active Directory Administrator
  • Interactive Training
  • Pricing
  • Brainstorm

Quick Links

  • About Us
  • Pricing
  • Brainstorm

Courses

  • Python
    • Introduction to Python
    • Python Developer
    • Expert Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
    • Expert JavaScript Developer
  • React
    • Introduction to React
    • React Developer
    • Expert React Developer
    • Professional Master React Developer
  • Linux
    • CyberSecurity - Introduction to Linux
    • CyberSecurity - Linux Administrator
    • CyberSecurity - Expert Linux Administrator
  • Active Directory
    • CyberSecurity - Introduction to Active Directory
    • CyberSecurity - Active Directory Administrator
    • CyberSecurity - Expert Active Directory Administrator

Newsletter

Subscribe to our monthly newsletter, for a quick update on Python, JavaScript, React news

© 2024 - 2026 STEMTrainingGrounds. All Rights Reserved.

Lesson 4 of 16

Lesson Progress: 0%

Code Example

# Integer variables
age = 10
score = 25

# Decimal variables
price = 2.5
height = 4.2

# String variables
name = "Sam"
message = "Hello"

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Loading...

Editor Output:

Click "Run Code" to see the output here
  • A variable is a name that stores something.
  • We use variables to remember values.
  • You make a variable by giving it a name and using =.
  • The = sign assigns a value into the variable.
  • age = 10 stores the number 10 in a variable called age.
  • score = 25 stores the number 25 in score.
  • Variables can store decimal numbers too.
  • price = 2.5 stores a decimal number.
  • height = 4.2 stores another decimal number.
  • Variables can also store words (text).
  • Text must be inside quotes " ".
  • name = "Sam" stores the word Sam.
  • message = "Hello" stores the word Hello.
  • Each line makes a new variable and saves something in it.

Code Example

# Addition with variables
a = 5
b = 2
print(a + b)

# Subtraction with variables
x = 8
y = 3
print(x - y)

# Multiplication with variables
m = 4
n = 2
print(m * n)

# Division with variables
p = 10
q = 5
print(p / q)

Instructions

▼ ← Click the triangle to hide or reveal instructions.

Python Code Editor

Task Incomplete

Editor Input:

Loading...

Editor Output:

Click "Run Code" to see the output here
Lesson Progress: 0%
Lesson Incomplete
← Previous: Operators
Lesson 4 of 16
Next: Lists →