+ 4

How to create function? With example?

15th Oct 2017, 10:14 AM
Jyoti Rane
Jyoti Rane - avatar
3 Respuestas
+ 1
1- def my_function(): #def define an new function called my_function.. and the ":" is needed 2- print("hello world") #this part can be any function, operations ,variable, out etc. and which is only applicable when the function is called... # while running . my_function () #output is hello world :) hope you understood
1st Jan 2018, 1:29 AM
Sumesh Murali
Sumesh Murali - avatar
+ 9
def howToCreateFunction: print("With example?") howToCreateFunction() #result: With example?
15th Oct 2017, 11:48 AM
Ahri Fox
Ahri Fox - avatar