Python is a high-level programming language known for its readability and simplicity. Created by Guido van Rossum and first released in 1991, Python emphasizes code readability and allows programmers to express concepts in fewer lines of code compared to other languages.
Here's a simple "Hello, World!" program in Python:
print("Hello, World!")
Example demonstrating basic variable declaration and arithmetic operations:
a = 10
b = 5
sum = a + b
product = a * b
print("Sum:", sum)
print("Product:", product)
Exploring lists and dictionaries in Python:
my_list = [1, 2, 3, 4, 5]
my_dict = {'name': 'John', 'age': 30, 'city': 'New York'}
print("First element:", my_list[0])
print("Dictionary:", my_dict)
Using conditional statements in Python:
number = 10
if number > 0:
print("The number is positive.")
else:
print("The number is not positive.")
Creating and using functions in Python:
def add(a, b):
return a + b
result = add(5, 3)
print("Sum:", result)