What is the use of def in python? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 1

What is the use of def in python?

Basics please

19th Nov 2018, 2:45 PM
Marwa Ashfaq
5 Réponses
+ 4
its used to declare a function, lets say your program needs to be adding two integers and you dont want to be using a+b You can just create a function which u can evoke anytime in yiur program eg. def plus(a,b): return a+b this is just an example in python..and you can do really cool stuffs with function
19th Nov 2018, 3:10 PM
Asaølu Elïjah
Asaølu Elïjah - avatar
+ 2
That is all in the tutorial you started - be patient just a while longer. ;-)
19th Nov 2018, 3:05 PM
HonFu
HonFu - avatar
+ 1
19th Nov 2018, 3:12 PM
Marwa Ashfaq
0
HonFu .I have a test tomorrow. Can you suggest me a link?
19th Nov 2018, 3:12 PM
Marwa Ashfaq
0
you are welcome bro
19th Nov 2018, 3:13 PM
Asaølu Elïjah
Asaølu Elïjah - avatar