Professional Documents
Culture Documents
Tutorial 2
Tutorial 2
Introduction
Python is a popular programming language known for its simplicity and readability. In this
tutorial, we will cover the basics of Python programming.
Step-by-Step Guide
python
Copy code
print("Hello, world!")
Copy code
python hello.py
python
Copy code
x = 5
y = "Hello"
z = 3.14
o Control Structures:
python
Copy code
if x > 0:
print("x is positive")
else:
print("x is not positive")
o Loops:
python
Copy code
for i in range(5):
print(i)
5. Functions
o Define and call a function:
python
Copy code
def greet(name):
return f"Hello, {name}"
print(greet("Alice"))