Part 3 | Functions | Python Malayalam Tutorial For Beginners | Python Coding Challenge

preview_player
Показать описание
24/7 FREE Telegram Support! Sign Up Now:

In this tutorial we will discuss functions.

Link to 100K Coding Challenge:

00:40 Function
11:29 Global variable ,Local variable
16:18 key word argument
17:58 Default argument
21:29 Dictionaries

About us:

Subscribe to Kerala's leading tech-career YouTube channel for free programming tutorials and tech-career videos in Malayalam. Learn the skills and knowledge needed to build a high-income career in IT. Join our community of future tech experts today!

Transform your career with 'Brocamp'—our 12 month Offline & Online training program that places you in a real office environment to master coding and in-demand skills. With over 1700+ successful placements averaging ₹40,000/month, secure your future with our proven career-focused training programs.

Ready to start your journey?
Connect with us: Call/WhatsApp us at 7034395811

To know more about Brocamp, Visit:

Рекомендации по теме
Комментарии
Автор

Simple calculator using python function

print("calculaor")
num1=int(input("enter two numbers:"))
num2=int(input())
print("\n 4.division")
option=int(input("choose your option:"))
def add(num1, num2):
sum=num1+num2
print("The sum is: "+str(sum))
def sub(num1, num2):
subr=num1-num2
print("The subraction result is: "+str(subr))
def multi(num1, num2):
mul=num1*num2
print("The multiplication result is: "+str(mul))
def divi(num1, num2):
div=num1/num2
print("The division result is: "+str(div))
if(option==1):
add(num1, num2)
elif(option==2):
sub(num1, num2)
elif(option==3):
multi(num1, num2)
elif(option==4):
divi(num1, num2)
else:
print("Please select the 4 options only !!")

ashikhp
Автор

# 4 types of function in python
# 1.No argument, No return value
def sample():
print("hello")
sample()
# 2.No argument, with return value
def sample1():
a=10
b=20
sum = a + b
return sum
result = sample1()
print(result)
# 3.with argument, no return value
def sample2(value):
print("value is: " +str(value))
sample2(123)
# 3.with argument, with return value
def sample3(num1, num2):
sum = num1 + num2
return sum
result1 = sample3(12, 24)
print(result1)

BinHaneef
Автор

# Below are four different codes which shows the examples of different types of functions
method=int(input("Enter corresponding number for if you want to execute the sum in the desired type\n 1- With arguments are with return\n 2- With arguments without return\n 3- Without arguments with return\n 4- Without argument without return\n Type your option: "))


if method == 1:
# Example of with arguments are with return
def sum(a, b):
result=a+b
return result
answer=sum(10, 10)
print (f"The answer is {sum(10, 10)}")
elif method == 2:
# Example for with arguments without return
def sum(a, b):
result=a+b
print("The answer is ", result)
sum(10, 10)
elif method == 3:
# Example with without arguments with return
a = 10
b = 10
def sum():
result=a+b
return result
answer=sum()
print ("The answer is "+str(answer))
elif method == 4:
# Example without argument without return
a=10
b=10
def sum():
result=a+b
line=f"The answer is {result}"
print(line)
sum()
else:
print("You can select one of the given option only")

akhileshsooraj
Автор

ingane oru kidukachi channel thodangiya karyam njn ipazha arinje. ithrem naal codingn vendi hindi channels kashtapett kand budhimutti orupaad. Anyway great initiative . :) :) :)

vivek-bhod
Автор

100K coding challengil ullathu polee daily tips add cheyythu kudee

shiharbinsidheeque
Автор

Its feeling super easy to code in Python. Thank u Crossroads Team for providing these videos

praveennair
Автор

# With arguement but without return value


def sum_of_numbers(num1, num2):
    sum = num1+num2
    print(sum)


sum_of_numbers(1, 2)

# With arguement and return value


def sum_of_numbers():
    num1 = 1
    num2 = 2
    sum = num1+num2
    print(sum)


sum_of_numbers()

# With arguement and return value


def sum_of_numbers(num1, num2):

    sum = num1+num2
    return sum


print(sum_of_numbers(1, 2))

# Without arguement  with return value


def sum_of_numbers():
    num1 = 1
    num2 = 2
    sum = num1+num2
    return sum


print(sum_of_numbers())

joelbeapen
Автор

def hello():
print("without argument without return value")

def hello1(a, b):
print("with "+a+" without " + b+" value")

def hello2():
a="without Argument"
b=" with return value"
sum=a+b
return sum

def hello3(a, b):
sum=("with "+a)+("with"+b)
return sum

hello()
hello1("Argument", "Return")
sum=hello2()
print(sum)
add=hello3("argument and ", "return value")
print(add)

basilkgeorge
Автор

#Example of with arguments with return
def add(num1, num2):
add=num1+num2
return result
result=add(10, 20)
print(result)

#Example of with arguments without return
def add(num1, num2):
res=num1+num2
print(res)
add(20, 20)
#Example with without arguments with return
a=20
b=30
sum=a+b
print(sum)
#Example without argument without return
a=10
b=20
def sum():
result=a+b
return result
answer=sum()
print(answer)

navaneeth
Автор

I was following eduerka and tech with Tim yt channels for python...but malayalathile class kooduthal understandable aanu...kudos crossroads

abbysp
Автор

#with argumet without return value
def add(a, b):
c=a+b
print(c)
add(12, 10)
#without argumet without return value

def add():
a=10
b=20
c=a+b
print(c)
add()
#with argumet with return value

def add(a, b):
c=a+b
return c
print(add(30, 10))

#without argumet with return value
def add():
a=30
b=40
return a+b
print(add())

befitlifestyle
Автор

# just a small shortcut that might help you guys:
# for eg:
name = "Crossroads"
age = 1
# so ...usually.. you print like this
:
# print("Hi " + name + " so you are almost" + str(age) + " year old!")
# instead, this is the shorthand trick ..if you want to call it
print(f'Hi {name} so you are almost {age} year old')
# Try it out and see what suits you!

hbmechanic
Автор

#function without argument

a=10
b=20
def sum1():
res1 = a+b
print("sum = "+ str(res1))

sum1()

#function with one argument

def sum2(num):
res2 = num+50
print("sum = "+ str(res2))

sum2(10)

#function wuth 2 arguments

def sum3(num1, num2):
res3 = num1+num2
print("sum = "+ str(res3))

sum3(30, 40)

#fuction with return value

def sum4(num1, num2):
res4=num1+num2
return res4
result= sum4(50, 30)
print("sum = "+ str(result))

_.adwaidh._
Автор

if anyone's wondering about the local variable, issue (value=value+1).

when u try to "assign" a global variable name, in function, it becomes a local variable ie, (value=value+1), here no connection to global (as assignment comes it is considered as local variable), soo the error came as value is not defined in function for the value='value'+1 quoted value.
additionally, s=value+1 worked because we are using the global name, no assignment just fetching the global value.

viper_solo
Автор

num1 = 5
num2 = 5

#No argument No return value
def sum() :
print("sum")
sum()
#No argument with return value
def sub():
a= 3
b= 5
add = a+b
return add
result = sub()
print (result)
#with argument no return value
def mul(num1, num2):
mul = num1*num2
print(mul)
mul(num1, num2)
#with argument with return value
def div(num1, num2):
if num2 ==0:
print("error")
else:
div = num1/num2
return div
result = div(num1, num2)
print(result)

honeylalmj
Автор

print('1.without arg and without return')
a=33
b=12
def mult():
c=a+b
print(c)

mult()

print("2. with argument without return")
def mult(a, b):
c=a*b
print(c)

mult(2, 3)

print("3.without argument with return")

def mult():
c=a/b
return c
c=mult()
print(c)

print("4. with argument with return")

def mult(x, y):
z=x-y
return z

z=mult(88, 18)
print(z)

muhammedthayyib
Автор

# function 1 with argument with return value
def sample(num1, num2):
sum = num1 + num2
return sum


a = int(input('Enter two numbers: \n'))
b = int(input())

sample(a, b)

print(result)

# function 2 with argument without return value
def sample(num1, num2):
sum=num1+num2
print(sum)

a = int(input('Enter two numbers: \n'))
b = int(input())

result = sample(a, b)

# function 3 without argument with return value
def sample(sum):
a = int(input('Enter two numbers: \n'))
b = int(input())

sum=a+b
return sum

result =sample(sum)
print(result)

# function 4 without argument without return value
def sample ():
a = int(input('Enter two numbers: \n'))
b = int(input())

sum = a + b
print(sum)

sample()

devusumesh
Автор

function without argument and return value
def fun():
print("hello bro")
fun()


function with argument and no return value
def a(num1, num2):
result=int(num1)+int(num2)
print("result is " +str(result))

a(8, 8)




function with argument and return value
def b(num3, num4):
result1=int(num3)+int(num4)
return result1
result1= b(8, 10)
print("result is" +str(result1))


function without argument and with return value
def add():
num5=10
num6=20
result2=int(num5)+int(num6)
return result2
solution=add()
print("result is" +str(solution))

arfexadstoloesthomas
Автор

print("**NO ARGUMENT NO RETURN VALUE**")
def display1():
num1 = int(input("Enter two numbers: "))
num2 = int(input())
sum = num1 + num2
print("Sum is " + str(sum))
display1()

print("**WITH ARGUMENT NO RETURN VALUE**")
def display2(value1, value2):
sum = value1 + value2
print("Sum is " + str(sum))
num1 = int(input("Enter two numbers: "))
num2 = int(input())
display2(num1, num2)

print("**WITHOUT ARGUMENT WITH RETURN VALUE**")
def display3():
num1 = int(input("Enter two numbers: "))
num2 = int(input())
return (num1+num2)
sum = display3()
print("Sum is " + str(sum))

print("**WITH ARGUMENT WITH RETURN VALUE**")
def display4(value1, value2):
return (value1+value2)
num1 = int(input("Enter two numbers: "))
num2 = int(input())
sum = display4(num1, num2)
print("Sum is " + str(sum))

homelander
Автор

# Calculater program using functions


num1 = int(input("Enter two numbers : "))
num2 = int(input())


# Function with argument without return value
def sum(num1, num2):
result = num1 + num2
print("Result is : " + str(result))


# Function with argument and return value
def minus(a, b):
result = a - b
return (result)

# Function without argument, with return value
def multiplication():
result = num1 * num2
return (result)

# Function without argument, without return value
def division():
result = num1 / num2
print("Result is : " + str(result))


choice = int(input("Select your choice : \n 1.Addition \n 2.Subraction \n 3.Multiplication \n 4.Division \n"))

if choice == 1:
sum(num1, num2)
elif choice == 2:
result = minus(num1, num2)
print("Result is : " + str(result))
elif choice == 3:
result = multiplication()
print("result is : " + str(result))
elif choice == 4:
division()

ahsanzakir
visit shbcf.ru