This script covers the basics of Python including:
- Variables and Data Types
- Lists
- Tuples
- Dictionaries
- Control Flow
- Loops
- Functions
- Classes
This script demonstrates the use of various variables and data types in Python. It includes:
- Integer
- Floating point
- String
- Boolean
- List
- Tuple
- Dictionary
This script demonstrates the use of basic math operations in Python. It includes:
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
- Exponentiation
- Floor division
Each operation is performed on two variables, a
and b
, which are set to 10 and 20 respectively.
You can run the script by using the following command in your terminal:
python3 mathbasic.py
This script demonstrates the importance of methods in Python.
Methods allow us to write a piece of code once and reuse it, which makes our code more organized and easier to maintain.
In this script, we create a method greet_user
that greets a user. We then use this method to greet three different users.
You can run the script by using the following command in your terminal:
python3 methods.py
This script demonstrates the importance of classes in Python.
Classes allow us to define a blueprint for an object, which we can then use to create as many objects as we want. This makes our code more organized and easier to maintain.
In this script, we create a Car
class with a name
, a color
, and a start
method. We then use this class to create two cars and start them.
You can run the script by using the following command in your terminal:
python3 classes.py
This script demonstrates the different types of loops in Python. It includes:
- For loop
- While loop
- Nested loops
- Loop control statements (break and continue)
You can run the script by using the following command in your terminal:
python3 loops.py