How to Write Functions in Python – From First Principles

preview_player
Показать описание
By the end of this video, learners will:
- Understand what a function is and why it's useful.

- Learn how to define and call functions in Python.

- Grasp the concepts of parameters, arguments, and return values.

- Be able to write clean, reusable code using functions.

💬 Join our Discord Community
Get help, share your progress, and connect with other learners:

💻 Get the Code on GitHub
Clone the full project and follow along:

👍 If you find this helpful, like, comment, and subscribe to stay updated on more beginner-friendly coding videos!
Рекомендации по теме
Комментарии
Автор

def square(num):
return pow(num, 2)
print(square(6))

Rockphil
Автор

def add(a, b, c):
return a + b + c
print(add(1, 2, 3))

Rockphil
Автор

def square(num):
return num * num
print(square(6))

Rockphil
Автор

working with everything inside the function

def checks_even():
number = int(input("Enter any any number: "))

if number % 2 == 0:
print("The number is even")
else:
print("The number is odd")

checks_even()


working with input outside the function


number = int(input("Enter any any number: "))

def checks_even(number):


if number % 2 == 0:
print("The number is even")
else:
print("The number is odd")

checks_even(number)

Rockphil
Автор

def combine_strings(str1, str2):
return str1 + str2

str1 = input("Enter Your name: ")
str2 = input("Enter Your proffession: ")

combined = combine_strings(str1, str2)
print(f"My name is {str1} and my proffession is {str2}")

Rockphil