+ 1

What is function of def() in python

28th Feb 2023, 1:59 PM
Sarfaraj Bagwan
Sarfaraj Bagwan - avatar
2 Answers
+ 5
There is no def() in python i think. There is def keyword in python and def followed by identifier with( <arguments> ) : <function body> will tells the interpreter the this is a function definition ex: a function add for adding two numbers and returns sum, is : def add( a, b ) : sum_ab = a + b return sum_ab; You can use or call it as print( add(4, 5)) or Add = add(4, 5) print( Add)
28th Feb 2023, 2:10 PM
Jayakrishna 🇼🇳
+ 1
Thanx
28th Feb 2023, 2:14 PM
Sarfaraj Bagwan
Sarfaraj Bagwan - avatar