Answered You can hire a professional tutor to get the answer.

QUESTION

I'm supposed to print a polygon for 12 players but my code prints out extra table. I can't seem to find what I did wrong. importrandom# allows me to...

but my code prints out extra table.

I can't seem to find what I did wrong.

import random # allows me to use random

import turtle

#task1

def pocker_hand():

  all_cards = ["A","2","3","4","5","6","7","8","9","J","Q","K"]# variable that creates list of cards A-K

  for i in range (5): #loop for 5 cards

    pocker_hand=random.choice(all_cards)

    print(pocker_hand, end=' ')

  print("") 

pocker_hand() #calling the method

#task 2

def pocker_game(num_players):

  for i in range(num_players):

    print("player:", str(i+1) +":", end=' ')

    pocker_hand()

pocker_game(8)

#task 3

def poker_jackpot(num_players, avg_bet):

  turns=num_players-1

  jackpot=0

  tracking_players=num_players

  for i in range (num_players-1):

    jackpot+= tracking_players * avg_bet

    tracking_players -=1

  print("Total Jackpot after", turns, "rounds:$" +str(jackpot))

poker_jackpot(5,10)

#task 4

def poker_table (num_players,side_length, x,y):

  win = turtle.Screen()  #window Object

  win.title("Draw Table") # Window Title

  win.setup(500, 500)    # Window Pixel

  win.bgcolor("blue") # sets the background color

  Mike= turtle.Turtle() # turtle object

  Mike.fillcolor("yellow")

  Mike.penup()

  Mike.goto(x,y)

  Mike.pendown()

  Mike.begin_fill()

  for i in range (num_players): #loop for number of players on the table

    Mike.forward(side_length)

    Mike.left(360/num_players) # draws the 

  Mike.end_fill()

poker_table(12,50,36,20)

def side_table(num_players,side_length, x,y):

  win = turtle.Screen()

  win.title("Draw Table")

  win.setup(500, 500)

  win.bgcolor("blue") # sets the background color

  Mike= turtle.Turtle()

  Mike.penup()

  Mike.goto(x,y)

  Mike.pendown()

  Mike.begin_fill()

  for i in range (num_players):

    Mike.forward(side_length)

    Mike.right(360/num_players/2 +180)

    Mike.begin_fill()

    Mike.fillcolor("Orange")

    Mike.circle(25)

    Mike.end_fill()

    Mike.left(360/num_players/2 +180)

    Mike.left(360/num_players) 

  Mike.end_fill()

side_table(12,50,36,20)

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question