Python Forum
Help in writing a basic function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help in writing a basic function (/thread-9770.html)



Help in writing a basic function - meru120 - Apr-27-2018

:I'm learning to write python code with a book, In the chapter about functions there is the following function example
def seven_eleven():
    x = 8
    y = 30
    return x, y


def main():
    var1, var2 = seven_eleven()
    print var1, var2
I tried to write the code but the output was "Process finished with exit code 0" instead of 8 and 30
?what did i do wrong


RE: Help in writing a basic function - Gribouillis - Apr-27-2018

You need to call function main() to execute it. Add
main()
at the end of the program.