Week #1 "What is the evolutionary history of the Python?" '+' #' Basics'/n'
Satender Kumar
Information Security Analyst | SIEM & Threat Detection (Splunk, Wireshark) | Cloud Security | Python & Automation | Risk & Compliance (NIST, ISO 27001, GDPR) | Security+ | CySA+ | SSCP
Background of Python:
Origin: Python, created by Guido van Rossum, emerged in the late 1980s as a side project to address shortcomings in the ABC language. In February 1991, Python version 0.9.0 was released. The language's name was inspired by the British comedy group Monty Python, showing Guido's appreciation for their humor. Python's development continued, and in 2000, Python 2.0 was released, introducing features like garbage collection and Unicode support.
- Philosophy: Python emphasizes readability, simplicity, and explicitness in code. This is often summarized as "The Zen of Python," which you can view by typing import this into a Python interpreter. Some key principles include "Readability counts" and "Simple is better than complex."
Design: Python is designed to be versatile and flexible, allowing developers to accomplish tasks with fewer lines of code compared to other languages. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming.
Python's popularity soared due to its simplicity, readability, and versatility. It gained traction in various fields, including web development, scientific computing, data analysis, and automation. In 2008, Python 3.0 was released, aiming to address inconsistencies and improve the language's design. However, the transition from Python 2 to Python 3 was gradual due to compatibility issues, with Python 2 finally reaching its end of life in January 2020.
Evolution of Python:
Python 2 vs. Python 3: In 2008, Python 3 was released as the successor to Python 2. Python 3 introduced several improvements and new features while addressing some of the shortcomings of Python 2. However, due to differences in syntax and functionality, Python 2 code is not always compatible with Python 3.
Given below is a timeline of the release of the various versions of the Python 3.X series:
Python 2
def main():
print "Hi! This is Python 2"
if __name__== "__main__":
main()
Python 3
def main():
print ("Hi! This is Python 3")
if __name__== "__main__":
main()
Python's web frameworks, such as Django and Flask, enable rapid development of web applications, while its scripting capabilities make it invaluable for automation and system administration tasks. Additionally, Python's cross-platform compatibility allows code written in Python to run seamlessly on various operating systems, further enhancing its appeal.
"Important Information:- noted"
Python has a rich ecosystem of libraries and frameworks across various fields, making it versatile and suitable for a wide range of applications.
Here's an overview of some popular libraries and the fields they are commonly used in:
Web Development:
Data Science and Machine Learning:
Natural Language Processing (NLP):
Web Scraping and Crawling:
GUI Development:
Game Development:
Web Scraping and Crawling:
Testing and Quality Assurance:
Other Popular Libraries:
Step -1 "Installing Python:- In Your Set up.
You can run as well in other Plateform Such as ( Replit is an AI-driven software creation platform where everyone can build, share, and ship software fast.)
Getting Started with Python: ( "Please ignored some things if you dont know for now")
print("Hello, World!")
Out put Below
print("Hello, World!")
Save the file with a '.py' extension, for example, 'hello.py.' Then, open a command prompt or terminal, navigate to the directory where you saved the file, and type python hello.py to run the program. You should see "Hello, World!" printed to the console.
# Variables and Data Types
name = "John" # string
age = 30 # integer
height = 5.9 # float
is_student = True # boolean
Out put Below
# Variables and Data
Types name = "John" # string
age = 30 # integer
height = 5.9 # float
is_student = True # boolean
# This is a comment # Comments are ignored by the interpreter
# Basic Arithmetic
result = 10 + 5 # addition
result = 10 - 5 # subtraction
result = 10 * 5 # multiplication
result = 10 / 5 # division
# Basic Arithmetic
result = 10 + 5 # addition
领英推荐
result = 10 - 5 # subtraction
result = 10 * 5 # multiplication
result = 10 / 5 # division
'<Some Basic Arithmetic which you see next to post>'
"Internal" and "external" Python typically refer to different aspects of the Python environment and ecosystem.
Internal Python:
External Python:
In Python, a module is a file containing Python code. The code can define functions, classes, variables, or even executable code that can be reused in other Python programs. Modules help organize and structure code into logical units, making it easier to manage and maintain large projects.
Here's a breakdown of modules in Python:
Creating Modules:
To create a module, you simply create a Python file with a .py extension and write your code inside it. For example, let's create a module named my_module.py:
# my_module.py
def greet(name):
print("Hello, " + name + "!")
Using Modules:
Once you've created a module, you can use it in other Python scripts by importing it. For example:
# main.py
import my_module
my_module.greet("Alice")
Module Attributes:
Modules can contain variables, functions, and classes that can be accessed using dot notation. For example, if my_module.py contains a variable PI:
# my_module.py
PI = 3.14159
You can access it in another script like this:
# main.py
import my_module
print(my_module.PI)
Module Search Path:
When you import a module, Python searches for it in a list of directories known as the module search path. This path includes the directory containing the script being executed and the directories listed in the PYTHONPATH environment variable.
Standard Library Modules:
Python comes with a rich set of standard library modules that provide additional functionality for common tasks such as file I/O, networking, data manipulation, and more. You can import these modules in your scripts just like any other module. For example:
import os
import random
import datetime
Third-Party Modules:
In addition to the standard library, Python has a vast ecosystem of third-party modules available for various purposes. These modules can be installed using package managers like pip and imported into your scripts as needed.
'pip' (Python Package Installer):
pip is the package installer for Python. It's a command-line tool that allows you to install, upgrade, and manage Python packages from the Python Package Index (PyPI) and other package repositories.
Installing Packages with pip:
You can install packages using pip by running the following command in your terminal or command prompt:
pip install package_name
For example, to install the requests package:
pip install requests
Managing Packages:
pip also allows you to manage packages, including upgrading and uninstalling them. For example:
Python Types:
Python is a dynamically-typed language, meaning you don't need to explicitly declare the data type of a variable. Python has several built-in data types, including:
Python also supports custom data types through classes and objects.
Reference:-
Downey, A. B. (2015). Think Python: How to Think Like a Computer Scientist (2nd Edition). O'Reilly Media.
Lutz, M. (2013). Learning Python (5th Edition). O'Reilly Media.
Sweigart, A. (2015). Automate the Boring Stuff with Python: Practical Programming for Total Beginners. No Starch Press.
Beazley, D. M. (2009). Python Essential Reference (4th Edition). Addison-Wesley Professional.
Pilgrim, M. (2004). Dive Into Python. Apress.
Guttag, J. V. (2016). Introduction to Computation and Programming Using Python: With Application to Understanding Data. MIT Press.
McKinney, W. (2017). Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython (2nd Edition). O'Reilly Media.
VanderPlas, J. (2016). Python Data Science Handbook: Essential Tools for Working with Data. O'Reilly Media.
Beazley, D. M. (2009). Python Cookbook (3rd Edition). O'Reilly Media.
Ramalho, L. (2015). Fluent Python: Clear, Concise, and Effective Programming. O'Reilly Media.
Van Rossum, G., & Drake, F. L. (2009). Python 3 Reference Manual. CreateSpace.
Django Documentation: https://docs.djangoproject.com/en/stable/
Flask Documentation: https://flask.palletsprojects.com/en/stable/
NumPy Documentation: https://numpy.org/doc/
Pandas Documentation: https://pandas.pydata.org/docs/
Matplotlib Documentation: https://matplotlib.org/stable/contents.html
SciPy Documentation: https://docs.scipy.org/doc/
Scikit-learn Documentation: https://scikit-learn.org/stable/documentation.html
TensorFlow Documentation: https://www.tensorflow.org/guide
Python Official Documentation: https://docs.python.org/3/