1/5
## Our first Python file We've been working with `cells.ipynb` files. Let's create our first basic Python file. This is how professional software engineers work with Python. Google Colab and these Jupyter Notebooks are great for testing, tinkering, learning, and working with stuff and the like, but they aren't great for professional environments. This is because, similar to Remix, if we wanted to test something and had to do shift-enter or execute all these cells at the same time, it could be very annoying. This isn't how professional projects work. What they do instead is they create Python files to run and execute. For example, we are going to create a new file called `basic_python.py`. The `.py` file extension is how VS Code and other Python tools know that this is a Python file. In here, we can type and run kind of the basic Python stuff. We can do ```python print("hi") ``` in here. Remember, this little white dot means it's not saved. Hit `command s` to save it. And then we can hit this little plus button that comes with this, and it will run my Python file with this `hi`. Now there is a whole bunch of other stuff that it will do, and so this is kind of like a cheat sheet shortcut. This is something that you can use to run your Python files. However, we are going to discourage that use for a lot of reasons. Instead, in your terminal, if you do ```bash ls ``` you can see we have this `basic_python.py`. We are going to write ```bash python3.11 basic_python.py ``` Hit enter and we will see it prints out `hi`. This is how we can execute an entire file of Python, like so.
A practical guide to creating and running a Python file using the Terminal. This lesson demonstrates the basics of setting up a Python file, running it using the Terminal, and understanding the .py file extension.
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