Why does my return statement ignore the rest of my code in a function in python?

Elton Ray Coelho

In my function, I type in a raw_input after my return statement and then I proceed to call my function. When I call my function the raw_input is totally ignored and only the return statement works.

    def game():
       #This selects 5 community cards from the pick_community function
        community = pick_community(5)
        card_4  = community[3]
        card_5  = community[4]
        first_3 = community[0:3]
        return first_3

        river = raw_input("If you are done with the round hit enter:" )
        try:
            if river =="":
                return card_4
        except:
            print "Dont cheat man"
            exit()
user4712192

That:

return first_3

returns and therefore ends the function. The remaining code is just ignored, because you will never get past the return.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why does my function not execute in python code?

From Dev

Why does my function not return value to global variable? [Python]

From Dev

Why does my php code return inf?

From Dev

Why does my code return 1 always?

From Dev

What does the function "return" do in my code?

From Dev

What does the function "return" do in my code?

From Java

Why does my recursive function return None?

From Dev

Why does my ajax function return false?

From Dev

Why does my recursive function return "undefined"?

From Dev

Why does my IF statement not work on python?

From Dev

Why does Java jump after my return statement

From Dev

Why does my postgresql SELECT statement return 0 rows?

From Dev

Why does my if else statement return the incorrect result?

From Dev

Why does my code produce this output (Python)?

From Dev

Why is this if statement in my code ignored?

From Dev

Why is my code bypassing my else if statement?

From Dev

Why is my code returning my else: statement?

From Dev

Why does inserting a printf statement make my function work correctly?

From Dev

Why does inserting a printf statement make my function work correctly?

From Dev

Why does my sql statement work in my editor but not my JS function?

From Dev

why does my python code not encrypt or decrypt my message

From Dev

why does my python code not encrypt or decrypt my message

From Dev

Why does my Scrapy code return an empty array?

From Dev

Why does my sin calculating code in C return the wrong value?

From Dev

Why does my n-queens code return empty lists?

From Dev

Why does my code return wrong sum when i concatenate it?

From Dev

Why is my bash function returning an unexpected return code?

From Dev

Why does my API return {}

From Dev

Why does my reduce based average function return NaN?

Related Related

  1. 1

    Why does my function not execute in python code?

  2. 2

    Why does my function not return value to global variable? [Python]

  3. 3

    Why does my php code return inf?

  4. 4

    Why does my code return 1 always?

  5. 5

    What does the function "return" do in my code?

  6. 6

    What does the function "return" do in my code?

  7. 7

    Why does my recursive function return None?

  8. 8

    Why does my ajax function return false?

  9. 9

    Why does my recursive function return "undefined"?

  10. 10

    Why does my IF statement not work on python?

  11. 11

    Why does Java jump after my return statement

  12. 12

    Why does my postgresql SELECT statement return 0 rows?

  13. 13

    Why does my if else statement return the incorrect result?

  14. 14

    Why does my code produce this output (Python)?

  15. 15

    Why is this if statement in my code ignored?

  16. 16

    Why is my code bypassing my else if statement?

  17. 17

    Why is my code returning my else: statement?

  18. 18

    Why does inserting a printf statement make my function work correctly?

  19. 19

    Why does inserting a printf statement make my function work correctly?

  20. 20

    Why does my sql statement work in my editor but not my JS function?

  21. 21

    why does my python code not encrypt or decrypt my message

  22. 22

    why does my python code not encrypt or decrypt my message

  23. 23

    Why does my Scrapy code return an empty array?

  24. 24

    Why does my sin calculating code in C return the wrong value?

  25. 25

    Why does my n-queens code return empty lists?

  26. 26

    Why does my code return wrong sum when i concatenate it?

  27. 27

    Why is my bash function returning an unexpected return code?

  28. 28

    Why does my API return {}

  29. 29

    Why does my reduce based average function return NaN?

HotTag

Archive