![]() |
what is python,quick - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: what is python,quick (/Thread-what-is-python-quick) |
what is python,quick - vluzzy - 01-02-2024 Python is a versatile and high-level programming language known for its readability and simplicity. Here are some fundamental concepts: Variables and Data Types: python message = "Hello, Python!" age = 25 pi = 3.14 Control Structures: python if age < 18: print("You are a minor.") elif age >= 18 and age < 60: print("You are an adult.") else: print("You are a senior citizen.") Loops: python for i in range(5): print(i) while age < 30: print("Still young!") age += 1 Functions: python def greet(name): print(f"Hello, {name}!") greet("Alice") Lists and Dictionaries: python my_list = [1, 2, 3, 4, 5] my_dict = {"name": "John", "age": 30} File Handling: python with open("example.txt", "r") as file: content = file.read() Exception Handling: python try: result = 10 / 0 except ZeroDivisionError as e: print(f"Error: {e}") |