#python #programming #pythonbasic #class12python
How to make geometric figures from python?
Write the following code to generate geometric figures in Visual Studio Code.
Code--
from turtle import*
clear()
pensize(5)
for i in range(6):
right(60)
for i in range(3):
forward(100)
right(120)
You can also make square, pentagon, etc. by changing the value of '3' in this part of code:-
for i in range(3):
forward(100)
right(120)
But remember also you have to change the value of right(120) by dividing 360 by the value of range.
Ex- for i in range(4)
then the value of 'right' will be 360/4=90
The value of 'forward' will be same.