Python basics to advance
Exercise1= Variables, Builtin Functions.
Exercise2= Operators
Exercise3= Strings, Lists, Tuples
Exercise4= Sets, Dictionary
Exercise5= Conditionals, Loops
Exercise6= Functions,
Exercise7=
Python is a high-level, interpreted programming language known for its simplicity and readability.
It is widely used in web development, data science, artificial intelligence, automation, and scientific computing.
Download from the official website:
https://www.python.org/downloads/
During installation (Windows), make sure to check:
☑ Add Python to PATH
Open terminal or command prompt:
python --versionor
python3 --versionCreate a virtual environment:
python -m venv myenvActivate:
Windows
myenv\Scripts\activateMac/Linux
source myenv/bin/activateDeactivate:
deactivateInstall Jupyter:
pip install notebookStart Jupyter:
jupyter notebookCreate a new Python notebook and start coding.
print("Hello, World!")name = "Raj"
age = 21
height = 5.8# Integer
x = 10
# Float
y = 3.14
# String
text = "Python"
# Boolean
flag = True
# List
numbers = [1, 2, 3]
# Dictionary
person = {"name": "Raj", "age": 21}age = 18
if age >= 18:
print("Adult")
else:
print("Minor")for i in range(5):
print(i)count = 0
while count < 5:
print(count)
count += 1def greet(name):
return f"Hello, {name}!"
print(greet("Raj"))class Student:
def __init__(self, name, age):
self.name = name
self.age = age
def introduce(self):
return f"My name is {self.name} and I am {self.age} years old."
s1 = Student("Raj", 21)
print(s1.introduce())Install packages using pip:
pip install numpyList installed packages:
pip listSave file as main.py and run:
python main.py- NumPy (Scientific computing)
- Pandas (Data analysis)
- Matplotlib (Visualization)
- Flask / Django (Web development)
- Scikit-learn (Machine learning)
- Scipy
- Qiskit (Quantum SDK)
- Beginner-friendly
- Large community support
- Massive ecosystem of libraries
- Used in AI, ML, Quantum Computing, Web, Automation
Happy Coding @RajMajhi