Student Summer Sprint
  • Welcome to Hackathons for Schools Student Summer Sprint!
  • Event Information
  • What is the Student Summer Sprint?
  • Useful Event Information and Links
  • Schedule
  • Our Organisers, Panelists and Mentors
    • Organisers
    • Panelists and Speakers
    • Mentors
  • Project Details
    • Themes
    • Judging Criteria and Winning Teams
    • Presentation Advice
    • Submission Checklist and FAQs
  • Coding Platform and GitLab
  • Technical Workshops
    • How to Use Git
      • Git and the Terminal
      • How to use Git - The Basics
      • Branching, Merging and Other Useful Commands
      • How to use Git - Further Resources
    • Web Development
      • HTML
      • CSS
      • JavaScript
      • Web Development - Resources
    • Introduction to Python
      • Variables
      • Data Types and String Formatting
      • Input and Output
      • Conditional Statements
      • Functions
      • Libraries
      • CHALLENGES
        • Solutions
      • Learning Python - Resources
    • Discord Bots in Python
      • Discord Bots - Resources
    • Web Scraping in Python
  • Careers Advice and Opportunities
    • University Advice
      • University Advice - Further Resources
    • CV, Applications and Interviews
      • Creating a Great CV
      • UCAS Personal Statement Advice
      • Interview Hints and Tips
      • Ultimate LinkedIn Guide
      • Applications - Further Resources
    • Different routes into a tech career
      • Different Routes into Tech - Further Resources
    • What Now?
      • More Opportunities!
Powered by GitBook
On this page

Was this helpful?

  1. Technical Workshops
  2. Introduction to Python

Variables

A basic introduction to the concept of variables in Python.

A variable is a reserved memory location to store values. You identify these memory locations with variable names.

name = "Robert"
​print(name)

Here I'm using the = or 'assignment' operator to assign the value of "Robert" to the variable called name. I'm then outputting the value of this variable to the console, as was done in the previous section using the print() function.

Each variable has its own scope, where scope refers to the visibility of variables. In other words, which parts of the program can see or use it.

You can't get the value of a variable earlier than the line in which it was defined.

PreviousIntroduction to PythonNextData Types and String Formatting

Last updated 4 years ago

Was this helpful?