elemes/example_content/python_intro.md

1.1 KiB

Python Introduction Lesson

This lesson introduces the basics of Python programming.

Variables and Data Types

Python is a high-level programming language known for its simplicity and readability.

# This is a comment in Python
name = "John"  # String variable
age = 25       # Integer variable
height = 5.9   # Float variable
is_student = True  # Boolean variable

print(f"Name: {name}, Age: {age}, Height: {height}, Student: {is_student}")

Basic Operations

You can perform basic arithmetic operations in Python:

a = 10
b = 5

addition = a + b
subtraction = a - b
multiplication = a * b
division = a / b

print(f"Addition: {addition}")
print(f"Subtraction: {subtraction}")
print(f"Multiplication: {multiplication}")
print(f"Division: {division}")

---EXERCISE---

Write a Python program that prints "Hello, Python!" to the console.

---INITIAL_CODE--- print("Write your Python code here") ---END_INITIAL_CODE---

---EXPECTED_OUTPUT--- Hello, Python! ---END_EXPECTED_OUTPUT---

---SOLUTION_CODE--- print("Hello, Python!") ---END_SOLUTION_CODE---