3 Answers
+ 2
In python you have to have the method code above the method that calls it, otherwise it won't work.
You declare the method with "def" followed by the method name and parameters, you dont have to declare the return type, public/private/protected or static. Does python have those types of things? I don't know, probably, I'm new to python as well. But you do call the method the same as Java.
https://code.sololearn.com/cO0105ggX77M/?ref=app
0
Functions work very similarly in almost any programming language.
1: You define it with name, certain amount of named parameters and a codeblock.
2: You call the function with the function name and give it the wanted amount of arguments and the code block will run.
3: A value will be returned to the position where the function was called, (unless if the function has void as return type).
The main difference between functions in Python and Java is that in Python functions won't get a specified return type.
0
Thank you :3