Lab Tutorial
Python for C++ Programmers
- Introduction to Python for C++ programmers
- The Zen of Python
- Example Python program
- Python vs. C++ - Main function
- Python vs. C++ - Variable declaration
- Python vs. C++ - Semicolons
- Python vs. C++ - Braces
- Python vs. C++ - Comments
- Running Python
- Running Python as a script
- Running Python interactively
- Basic built-in data types
- Everything is an object
- Reserved words
- Variables - C++ vs. Python
- Python Variables
- Objects in Python
- Operators
- Assignment operator
- Lists
- Accessing Lists
- Modifying Lists
- Tuples
- Strings are sequences
- Formatting strings
- Sets
- Dictionaries
- Grouping data with dict and tuple
- Control flow
- Loops
- Useful objects for loops
- List comprehensions
- Functions
- Function arguments
- Built-in functions
- Object-Oriented Programming in Python
- Constructor
- Attributes
- Methods
- Magic/Dunder methods
- Inheritance
- Encapsulation
- Encapsulation the Pythonic way
- What about protected?
- Python modules
- Custom modules
- What's in a __name__?
- Handling text files
- Reading CSV files
- Writing to CSV files
- Handling JSON files
- Pickle
- That's a wrap!
Python vs. C++ - Variable declaration
You also do not need to declare variables in Python. In Python, variables are just labels that point to object instances in memory, and are not statically bound to a specific data type. We will talk about this a bit more later.