user86872
user86872

Reputation: 1

Output Printing After Raw Input: Out of Order in Python

When I try to run the following function, the output is incorrect. I've got print statements before a raw_input variable. It's asking for the raw_input variable and then printing the statements, like so:

    def getPlayerBid(hand1, bidList):

        print ""            
        print 'Your Cards: ' + " ".join(hand1)
        print 'Previous bids: '
        for item in bidList:
            print item
        print ""
        bid1 = int(raw_input('What\'s your bid?(Enter 0 to pass): '))
    ....

This is the output:

What's your bid?(Enter 0 to pass): 
Your Cards: KH 2H 2D 5C 4D
Previous bids:

Any help with what I am doing wrong here would be great!

Upvotes: 0

Views: 596

Answers (1)

shaneb
shaneb

Reputation: 1474

Something like this happened to me once. Lines weren't printing in the order that they were being executed in the code. I was baffled. Then I realized that I was still piping the output to sort.

Upvotes: 0

Related Questions