Python Question
Task 4
Create a function named poker_table that uses Turtle Graphics to create a single poker table to accommodate all players. There should be four parameters: num_players indicates the number of players; side_length indicates the length in pixels of each side of the table; and x and y, which give the location where you should start drawing the table.
The poker table should be a simple regular polygon (that is, with sides of equal length). The number of sides of the table should be equal to the number of players (so that all players can sit at one table).

Notes:
The window should be at least 500 pixels x 500 pixels.
When calling the function, the values passed to the function may
vary but make sure the whole table is visible within the
window.
Here are some sample parameter values to help you get started:
12 players with a side length of 50 pixels
36 players with a side length of 20 pixels.
Hint #1: The angle the turtle will need to turn should be 360 divided by the number of sides.
Hint #2: Try using a for loop to generate the table.
Solution:
import turtle
def drawpolygon(num_players, side_length, x=0, y=0):
angle = 360 / num_players
sides = 1
window.fillcolor('#00ff00')
window.setx(x)
window.sety(y)
window.begin_fill()
while sides <= num_players:
window.bk(side_length)
window.right(angle)
sides = sides + 1
window.end_fill()
window = turtle.Turtle()
window.hideturtle()
window.ht
window.turtlesize(500, 500)
num_players = int(input('Enter value for number of
players:'))
side_length = int(input('Enter value for side length:'))
x = int(input('Enter x coordinate:'))
y = int(input('Enter y coordinate:'))
drawpolygon(num_players, side_length, x, y)
Output:

Python Question Task 4 Create a function named poker_table that uses Turtle Graphics to create a...
Turtle Graphics with nested loop: Write a turtle graphics python program repeat_squares.py that uses nested loops to draw 100 squares, to create this design: Turtle-squares.png starting with the smallest square in the bottom right-hand corner. Start at position (-4,4). At each step increase the length of each side by 4 pixels. Draw 100 squares. Please submit with an animation speed of 0 and the turtle hidden turtle.hideturtle()
Write a program called draw_shapes.py.
In your program,
Create a block header with:
your name
the date
a short description of what the program does:
Assignment 5: Draw shapes using turtle
Import the turtle module.
Create a window and screen (canvas) where your turtle will
draw. Make the window 400 pixels wide x 400 pixels high and give it
an indigo background and a title of "Shapes". Use this code to
create a window object:
# a place for the...
Write a function makePoly(x,y,n,l) that receives a coordinate point (x,y), an integer n representing the desired number of sides (3 to 20) , and an integer l between 10 and 200 pixels, inclusive, representing the length of each side. The function will then use the turtle to draw the requested n-sided polygon at the designated (x,y) coordinate, having sides of length l. Be sure to reject arguments that do not conform to the restrictions given. (Hint: to get a turtle...
Use Python: Dice Rolls Create a function named build_roll_permutations which returns all 36 permutations of rolling two six sided dice. That is, each dice has a number 1 through 6 on one of its sides. The return value is a list which contains tuples. Each tuple represents a possible dice roll of two dice. Card Deck Create a function named build_deck that returns a full deck of cards. The cards are created by a rank and a suit (e.g. 2♡)....
answer in matlab please
Create a separate function file fieldtovar.m that receives a single structure as an input and assigns each of the field values to user-defined variables. The function should work for a structure with any number of fields. Additionally, implement an error check to ensure that the number of user- defined variables (output arguments) is equal to the number of structure fields. Here are two examples of calling the function: » Boeing_747 = struct('Length', 70.6, WingSpan', 64.4, 'Engine',...
please use python
Question 4: Define a function named q40 that accepts a string as a parameter. After verifying that the string includes only includes numeric digits, count the number of even (E) and odd (O) digits. Finally, create a new string made up of these values and their sum. Repeat this process until your end result is a string containing 123 For example, '15327' contains 1 even digit (E-1), 4 odd digits(O-4) and the sum of these is 5...
Create a MATLAB function to perform Lagrange Interpolation. Your function will be used as illustrated below: >> ya = Lagrange(x, y, a) where "x" is a vector of ? independent data values, "y" is a vector of ? dependent function values corresponding to "x", "a" is an arbitrary value of "x" for which you want to know the Westimate of "y", and "ya" is the estimate of the function at x=a. Print an error message and exit the function if...
Please write the code using matlab
1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...
C or C++ Project Overview Wild, Wild, West! Dice Game The Wild, Wild, West! is an elimination dice game. It can be played by any number of players, but it is ideal to have three or more players. Wild, Wild, West! Requires the use of two dice. At the start of the game, each player receives a paper that will track the number of lives that player has. Each player starts the game with 6 lives. In the first round,...
Your will write a class named Gasket that can be used to build Gasket objects (that represent Sierpinski gaskets) that you can display graphically. Your Gasket class is defined in the provided file Gasket.h. DO NOT CHANGE the file Gasket.h. The attributes and methods defined for class Gasket are described below. ·sideLength an int that holds the length of each side of the Gasket. The length of the side is measured as a number of pixels ·xLocation an int that holds the x coordinate (in pixels)...