Introduction
Introduction and Setup: Understanding what Python is, its applications, and setting up your environment.
Python is a popular programming language. It can be used for developing varieties of software.
Nowadays, Python is popular for Data mining, Data Science, Data analytics, Machine learning.
Python is developed, created by Guido van Rossum, and released in 1991.
- Python works on several platforms like: Windows, Linux, Mac, Raspberry Pi etc.
- Python programs can be written in procedural way, and object-oriented way or functional way
- Python is readable as its syntax is similar to The English language
- Python allows developers to write program in fewer lines of code compared to other proramming languages.
- Python runs on an interpreter system.
Syntax Basics: Learning fundamental rules, including variables, data types (numbers, strings, Booleans), and basic input/output.
Operators: Understanding arithmetic, assignment, comparison, and logical operators.
Control Flow: Mastering conditional statements (if/else) and loops (for, while) to control program execution.
Data Structures: Deep diving into essential built-in data types:
- Lists: Ordered, changeable collections of items.
- Tuples: Ordered, unchangeable collections.
- Sets: Unordered collections of unique items.
- Dictionaries: Unordered collections of key-value pairs.
- Functions: Learning to define and use functions to organize code, including arguments, scope, and recursion.
- Modules and Packages: Using pre-written code (modules and libraries) to extend Python's functionality.
- File Handling: Reading from and writing to files.
- Exception Handling: Learning to manage errors gracefully using try/except blocks.
- Object-Oriented Programming (OOP): Understanding classes, objects, inheritance, and polymorphism, which are core pillars of Python development.
Installing Python (Assumed you are using Windows OS)
First check if Python is already installed in your system:
- Go to command prompt; C:\>
- Type: C:\>python --version
- If Python is install in your machine, you will get version number of python
- If not install, download python installer from https://www.python.org/downloads/
- Double click the installer, and follow the instructions
Python is an interpreted programming language, so we can write python program in
any text editor, save it with .py extension, and run in Python interpreter. Let's write a
simple Python program in a text editor:
print("This is a code written in Python")
- Save this file in folder of your choice with name first.py, suppose you have folder named py_progs in D:
- Open command prompt, go to D: drive:
- If you are in C:\ drive, then in command prompt, type D: like: C:\>D:
- You will be taken to D: drive, then type D:\> cd py_progs
-
- You will be in py_progs folder: then type python first.py like:
D:\py_progs\>python first.py
- You will see This is a code written in Python in the command prompt