1/5
## Variables in Python Let's talk about variables. In Python, we can assign different variables. Our generative AI is even giving us a suggestion here. And variables are essentially keywords that we can use to represent some other value. For example, we can say: ```python my_variable = 7 ``` Now, anytime we use this keyword, my_variable, it's going to represent the number 7. So, if we were to print out my_variable, what do you think it will print out? Well, if we hit this little play button here to execute the cell, we see it prints out the number 7 because my_variable now represents 7. The keywords or the names of your variables can be almost anything that you want. We can assign almost anything to a variable, and Python comes with many types. For example, we can assign numbers: ```python my_number = 10 ``` We can assign something called booleans which are true or false. We can say: ```python my_boolean = True ``` We can also do false. We can assign whole strings or text: ```python my_string = "hello!" ``` Strings are denoted by being between these little quotes here. We can use single quotes or double quotes, both work great in Python. If the word string is a little confusing to you, just know that anytime someone says hey, this is a string, a string just means it's text. It means it's not a number, it's not a boolean, it's just text.
A beginner’s guide to variables in Python. The lesson explains the concept of variables in Python, how to assign different data types to variables, and how to use the print() function to display variable values.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on January 14, 2025
Duration: 2h 20min
Duration: 1h 51min
Duration: 58min
Duration: 2h 23min
Duration: 53min
Duration: 2h 24min
Duration: 28min
Duration: 1h 54min
Duration: 11min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on January 14, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar