Beginner → Advanced + Code Examples
Python is a simple, powerful programming language used in web development, AI, and automation.
print("Hello Python")
name = "Sasank" age = 18 print(name, age)
x = 10 # int y = 3.5 # float z = "hello" # string flag = True # boolean
age = 18
if age >= 18:
print("Adult")
else:
print("Minor")
for i in range(5):
print(i)
def greet(name):
return "Hello " + name
print(greet("Sasank"))
arr = [1,2,3,4]
for i in arr:
print(i)
user = {
"name": "Sasank",
"age": 18
}
print(user["name"])
class Person:
def __init__(self, name):
self.name = name
p = Person("Sasank")
print(p.name)
file = open("data.txt","w")
file.write("Hello Python")
file.close()
import math print(math.sqrt(25))
# Simple calculator a = 10 b = 5 print(a + b) print(a - b)