I
I
Ivan2018-06-03 14:35:47
Python
Ivan, 2018-06-03 14:35:47

How to draw an Archimedean spiral in Python?

Help with drawing an Archimedean spiral with the turtle statement in python. What there should be a recursion?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
Web Dentist, 2018-06-03
@IvanPsarev

https://stackoverflow.com/questions/35485993/archi...
https://codereview.stackexchange.com/questions/144...

R
romangman, 2019-04-26
@romangman

Hello. I found this problem in the python course from MIPT. I’ll make a reservation right away, I started learning to code about a month ago.
There are 2 options - directly "drawing" the spiral with the turtle:
import turtle
turtle.shape('turtle')
k=1
fi_rad=0.1
fi_degr=fi_rad*(180/3.14)
for i in range (0,1000):
ro=k* fi_rad
turtle.forward(ro)
turtle.left(fi_degr)
fi_rad+=0.1
ro+=ro
or moving the turtle onto a spiral:
import turtle
turtle.shape('turtle')
import math
k=1
fi_rad=0.1
for i in range (0, 1000):
ro=k*fi_rad
x = math.cos(fi_rad)*ro
y = math.sin(fi_rad)*ro turtle.goto
(x,y)
fi_rad+=0.1
it is the anguish that you experience when solving a problem - that makes you google your query, generates new neurons in your brain and makes you smarter.
To help https://ru.wikipedia.org/wiki/%D0%90%D1%80%D1%85%D...
All the information you need to solve is in the first 2 paragraphs.
Good luck.

T
Ti-Jey, 2019-05-12
@Ti-Jey

import turtle
turtle.shape('turtle')
t=0.1
for i in range(760):
turtle.left(2)
turtle.forward(t)
t+=0.01
Я так это решал, возможно ошибался

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question