I can’t run Def in Python

Asked

Viewed 59 times

-2

How do I execute a def and a return in Python? I always do it in edit mode and when I run everything is blank, nothing comes out,?

  • 1

    Depending on what you’re doing, you didn’t post anything. You didn’t say how you did it.

1 answer

1

Assuming you’ve written a function, you have to call it, so if you’ve done something like this,:

def funcao()
    return 1

you need to call it that:

funcao()

I put in the Github for future reference.

But if you only want to perform without a function then you should not write a def.

If you want to learn to program I suggest you understand the concepts, go out doing nothing useful.

  • Dude, I did it this way, I already learned a lot about concepts, well I made a little code that measures factors, which also doesn’t come out anything gets blank. def fat (n): f = 1 while n > 0: f = f * n n = n - 1 Return f

  • So your question doesn’t say what the problem is.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.