VS Code run button doesnt work when using def python3

Viewed 18

As the title says when I try to run my code in vs code with the "run code button" when it contains a function like

    def plus(x,y):
        return x+y

it doesn't run. However, if I just use for example

    print("hello")

it runs smoothly and prints hello as expected. Thanks in advance.

2 Answers

This should work:

def plus(x,y):
    return x+y
print(plus(1, 2))

plus is just a function, and no function caller. Then print("helloword") is a statement.

i would suggest that you reinstall your vs code, it should work

Related