Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>the problem is in the def main():</p> <p>def main():</p> <pre><code> print ('------- ' * 4) print ('| | ' * 4) for x in range(4): print ('| ' +gameDeck._deck[currentCard]+'|'), currentCard += 1 print ('| | ' * 4) print ('------- ' * 4) </code></pre> <p>the * 4 just mean that this:</p> <pre><code>print ('------- ' * 4) </code></pre> <p>will become this:</p> <pre><code>print ('------- ' + '------- ' + '------- ' + '------- ' ) </code></pre> <p>it can also be type as:</p> <pre><code>print ('------- ------- ------- ------- ' ) </code></pre> <p>so. your problem is here:</p> <pre><code> for x in range(4): print ('| ' +gameDeck._deck[currentCard]+'|'), currentCard += 1 </code></pre> <p>this would print as:</p> <pre><code>| 7-H| | 5-H| | 7-H| | 9-H| </code></pre> <p>you need to put it as something like this:</p> <pre><code> print ('| ' +gameDeck._deck[currentCard]+'|'+'| ' +gameDeck._deck[currentCard+1]+'|'+'| ' +gameDeck._deck[currentCard+2]+'|'+'| ' +gameDeck._deck[currentCard+3]+'|') </code></pre> <p>so it would print in one line like how you want it:</p> <pre><code> | 7-H| | 5-H| | 7-H| | 9-H| </code></pre> <p>here is the code that i clean up a little. if it work like it should, it should work:</p> <pre><code>def main(): #sets player counters to zero, pOneCount = 0 pTwoCount = 0 #creates the deck to be put on the board gameDeck = Deck() gameDeck.gamePop() gameDeck.Shuffle() print(gameDeck._deck) currentCard = 0 for row in range(5): for card in range(0,4+i): print (' ------- ' * 4) print (' | | ' * 4) print (' | ' +gameDeck._deck[currentCard]+' | '+' | ' +gameDeck._deck[currentCard+1]+' | '+' | ' +gameDeck._deck[currentCard+2]+' | '+' | ' +gameDeck._deck[currentCard+3]+' | ') print (' | | ' * 4) print (' ------- ' * 4) </code></pre> <p>oh, and like John Y say (copy and paste):</p> <p>The main function has a dangling mystring =, which is a blatant syntax error</p> <p>here what i use to test, because the whole code don't work for me, i just tested the print part:</p> <pre><code>print (' ------- ' * 4) print (' | | ' * 4) print (' | ' +"1-H"+' | '+' | ' +"2-H"+' | '+' | ' +"3-H"+' | '+' | ' +"4-H"+' | ') print (' | | ' * 4) print (' ------- ' * 4) </code></pre> <p>that got me:</p> <pre><code> ------- ------- ------- ------- | | | | | | | | | 1-H | | 2-H | | 3-H | | 4-H | | | | | | | | | ------- ------- ------- ------- &gt;&gt;&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload