Is it possible to declare a function in python as we do in C
In c we can declare a function by adding a semicolon
int main(void);
is this possible to be done in python?
CodePudding user response:
You can you def for declaring a function.
CodePudding user response:
In python you don't need to specify return type : syntax
def function_name(parameters):
"""docstring"""
statement(s)
return expression
Use keyword def to create a function, if its a void function you don't need to mention parameters i.e
def fun():
print("Hello")