У нас вы можете посмотреть бесплатно Lecture 2 : Variables & functions | Python Full Course или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Python Variables A variable is a container for storing data values. In Python, you don’t need to declare a variable explicitly; its type is determined automatically when you assign a value. Creating Variables python Copy code name = "Alice" # String age = 25 # Integer height = 5.5 # Float is_student = True # Boolean Naming Rules Variable names must start with a letter or an underscore (_). They can contain letters, digits, and underscores (e.g., age1, my_var). Names are case-sensitive (age and Age are different). Multiple Assignments python Copy code x, y, z = 10, 20, 30 print(x, y, z) # Output: 10 20 30 Example python Copy code username = "John" user_age = 30 print(f"Name: {username}, Age: {user_age}") Python Functions A function is a block of reusable code that performs a specific task. Functions help organize and simplify your code. Defining a Function python Copy code def greet(name): print(f"Hello, {name}!") Calling a Function python Copy code greet("Alice") # Output: Hello, Alice! Functions with Return Values python Copy code def add_numbers(a, b): return a + b result = add_numbers(5, 10) print(result) # Output: 15 Default Arguments python Copy code def greet(name="Guest"): print(f"Hello, {name}!") greet() # Output: Hello, Guest! greet("Charlie") # Output: Hello, Charlie! Keyword Arguments You can specify arguments by their names when calling a function: python Copy code def describe_pet(pet_name, animal_type="dog"): print(f"I have a {animal_type} named {pet_name}.") describe_pet(pet_name="Buddy", animal_type="cat") Output: I have a cat named Buddy. Variable Scope Local Variables: Defined inside a function; accessible only within that function. Global Variables: Defined outside any function; accessible throughout the program. Example: python Copy code x = 10 # Global variable def modify_x(): global x x = 20 # Modifying the global variable modify_x() print(x) # Output: 20 Would you like to explore more advanced topics like lambda functions, recursion, or decorators? 😊