+ 1
Function
can someone clearly explain me how to call a function
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)
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
0
thank you