+ 1
The main function in Python
It seems like the main function in the CODE PLAYGROUND does not work. When I use the def main: syntax, my code does not compile...
2 Respuestas
+ 2
i recently started learning python after c++, and i feel like there is no main function... or am i wrong?
+ 3
There is no main() function in python. You can do
if __name__ == '__main__':
# code
This works in Sololearn too. However it's not the same as e.g. int main() in C++. You can define a function main(), but you'll have to call it yourself because it won't be called automatically