Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Sin , Cos Graph using python turtle.

# Sin , Cos Graph using python turtle module
from math import pi, sin, cos
import turtle



sc = turtle.Screen()

t = turtle.Turtle()
t.pensize(1)
t.pencolor("gray")
t.speed(0)

def goto(x, y):
      t.up()
      t.goto(x, y)
      t.down()

def rep():
      for x in range(-330, 330, 20):
            goto(x, 0)
            t.dot(3)
            t.sety(360)
            t.sety(-360)
      for y in range(-330, 330, 20):
            goto(0, y)
            t.dot(3)
            t.setx(360)
            t.setx(-360)
      goto(0, 0)
      t.pencolor("red")
      t.dot(8)
      
rep()
goto(-360, 0)

# t.speed(10)

for x in range(-360, 360, 5):
      t.pensize(3)
      t.pencolor("blue")
      t.goto(x, sin(pi / 180 * x)*128)      # Replace Sin with Cos if necessary.
      t.dot(3)
      
sc.exitonclick()
Comment

PREVIOUS NEXT
Code Example
Python :: django jinja subset string 
Python :: classification report value extration 
Python :: how to downgrade a package python 
Python :: django sum get 0 if none 
Python :: how to read a json resposnse from a link in python 
Python :: age calculator in python 
Python :: typage in python 
Python :: pandas create column from another column 
Python :: python - remove repeted columns in a df 
Python :: print terminal url 
Python :: pygame python3.8 
Python :: how to move mouse for one place to another python using pyautogui 
Python :: random matrix python 
Python :: decode base64 python 
Python :: which python mac 
Python :: quadratic formula python 
Python :: use sqlalchemy to create sqlite3 database 
Python :: Python Enemy NPC CLass 
Python :: Set up and run a two-sample independent t-test 
Python :: watch dogs 3 
Python :: how to set the location on a pygame window 
Python :: how to view the whole dataset in jupyternotebook 
Python :: python parse dict from string 
Python :: absolut beginners projects in python with tutorial 
Python :: python: separate lines including the period or excalamtion mark and print it to the prompt.. 
Python :: save plot in python 
Python :: python make integer into a list 
Python :: run py file in another py file 
Python :: views.home not found django 
Python :: Keras library for CIFAR-10 dataset 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =