+ 1

Function

can someone clearly explain me how to call a function

19th Jun 2017, 1:06 PM
Punith N Kothari
Punith N Kothari - avatar
3 odpowiedzi
+ 3
to create a function : 1-without argument def myfct(): print(3) and now just : myfct() -->3 2-with argument def myfct(n): print(n) and now just : myfct(4) -->4 myfct(6) -->6 I hope it can help you 😊 so yoo should just write the name of your function with () at the end and the argument when there is arguments (arg1,arg2,arg3)
19th Jun 2017, 1:25 PM
Hbeo
Hbeo - avatar
0
#Creating a function def anyfunc(): print('anything') #Calling function anyfunc() #and it will print this >>> anything #or you can use arguments for function def anyfunc(number): print(number + 1) #calling function anyfunc(5) #output (5 + 1) >>> 6
19th Jun 2017, 1:33 PM
Emil Manafov
Emil Manafov - avatar
0
thank you
19th Jun 2017, 1:35 PM
Punith N Kothari
Punith N Kothari - avatar