0% found this document useful (0 votes)
5 views4 pages

Pi

The document is a comprehensive guide to the basics of Python programming, covering essential topics such as variables, data types, operators, control structures, functions, file handling, and more. It also introduces advanced concepts like object-oriented programming and networking, and suggests pathways for specialized fields like ethical hacking, web development, and game development. Mastering these fundamentals will prepare learners to utilize specialized libraries in their respective domains.

Uploaded by

tc5dhwfvvq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Pi

The document is a comprehensive guide to the basics of Python programming, covering essential topics such as variables, data types, operators, control structures, functions, file handling, and more. It also introduces advanced concepts like object-oriented programming and networking, and suggests pathways for specialized fields like ethical hacking, web development, and game development. Mastering these fundamentals will prepare learners to utilize specialized libraries in their respective domains.

Uploaded by

tc5dhwfvvq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

The Complete Python Basics Guide

This file includes all the essential topics you need to learn in Python. Once you master these, you

will be ready to use any specialized libraries based on your field (ethical hacking, web development,

game dev, etc.).

1. Variables

name = "Ali"

age = 25

2. Data Types

- String: "hello"

- Integer: 5 U

- Float: 3.14

- Boolean: True / False

- List: [1, 2, 3]

- Tuple: (1, 2, 3)

- Set: {1, 2, 3}

- Dictionary: {"name": "Ali", "age": 25}

3. Operators

+ - * / // % **

== != > < >= <=

and, or, not

4. If Statements
if age >= 18:

print("Adult")

else:

print("Minor")

5. Loops

for i in range(5):

print(i)

while condition:

# do something

6. Functions

def greet(name):

print("Hello", name)

7. File Handling

with open("file.txt", "r") as f:

data = f.read()

8. Data Structures

Lists, Tuples, Sets, Dictionaries

9. Exception Handling

try:

x=1/0

except ZeroDivisionError:
print("Cannot divide by zero")

10. Libraries

import math

print(math.sqrt(16))

11. Date & Time

import datetime

now = datetime.datetime.now()

print(now)

12. Web Requests

import requests

res = requests.get("http://example.com")

print(res.text)

13. Object-Oriented Programming (OOP)

class Hacker:

def __init__(self, name):

self.name = name

h = Hacker("Ali")

print(h.name)

14. OS Interaction

import os

os.system("ls")
15. Networking

import socket

ip = socket.gethostbyname("example.com")

print(ip)

Once you finish these, you are ready to start with:

- Ethical Hacking: use libraries like socket, scapy, requests

- Web Dev: learn Flask or Django

- Game Dev: learn pygame

Good luck on your journey!

You might also like