Python Beginner Tutorial
Introduction
Python is a powerful, easy-to-learn programming language used for web development, data
science, automation, and more.
Installing Python
Download from <a href='https://www.python.org'>python.org</a> and install. Use an IDE like VS Co
Hello World Example
print('Hello, World!')
Variables & Data Types
x = 10
name = 'Alice'
is_active = True
pi = 3.14
Conditional Statements
age = 18
if age >= 18:
print('You are an adult')
else:
print('You are a minor')
Loops
for i in range(5):
print(i)
n = 3
while n > 0:
print(n)
n -= 1
Functions
def greet(name):
return 'Hello ' + name
print(greet('Alice'))
Lists
fruits = ['apple', 'banana', 'cherry']
for fruit in fruits:
print(fruit)
Dictionaries
student = {'name': 'John', 'age': 20}
print(student['name'])
File Handling
with open('test.txt', 'w') as f:
f.write('Hello File!')
Mini Project: Calculator
a = int(input('Enter first number: '))
b = int(input('Enter second number: '))
print('Sum:', a+b)