Functions - Day 6

Fathima Shaila - Jul 21 - - Dev Community

Functions

def my_name("name"):
def என்பது my_name எனும்function ஐ define செய்கிறது.

def welcome():
இந்த function welcome என்ற வார்த்தையை திரும்ப வழங்கும்
return "welcome, how are you ?"

welcome() என்ற function-ஐ call செய்தால், function-ல் return செய்த string print ஆகும்.

மற்றுமொரு எடுத்துக்காட்டு

def name(user_name):
return Welcome +" "+ user_name

print(name(Hiba))
print(name(Shayaan))
print(name(Arham))
print(name(Maisha))
print(name(Ayana))

Welcome Hiba
Welcome Shayaan
Welcome Arham
Welcome Maisha
Welcome Ayana

எ+கா
BMI calculator

def bmi_cal(weight,height)
return weight/ height**2

weight=float(input("Enter Your Weight (kg) :"))

height=float(input("Enter your height (m) :"))

print(f"Your BMI is {bmi_cal(weight,height)}:.2f")

Enter your Weight (Kg) :50
Enter your Height (m) :1.6
your BMI is 19.53

. . . . . . . . . .
Terabox Video Player