ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Python Turtle Graphics Tutorial for Absolute Beginners - Drawing a Spirographic

python turtle graphics tutorial for beginners

Python Turtle Graphics Tutorial for Absolute Beginners - Drawing a Spirographic

turtle in python tutorial

turtle in python 3

tech with tim

turtle python

turtle python tutorial

tutorial

coding

programming

beginner

turtle

draw

python tutorial

python turtle graphics

drawing in python

drawing shapes in python

python tutorial for beginners with examples

best python tutorial

easy python for beginners

beginner python exercises

Автор: Raza Zaidi

Загружено: 2021-03-12

Просмотров: 146137

Описание: Learn programming in Turtle, a Python Library, in this 2 minute tutorial for beginners. Playing around with the Turtle library is a great way to practise the basics susch as variables, lists, looping, functions and more.

—————————————————————
Drawing with Turtle - Spirographic
—————————————————————

In this tutorial we will code this piece of art in turtle, which is a python library.
To use the turtle library start with ‘import turtle’ 
For the background color we can use the turtle function
Set the background color to black
 
Next we need to create the object turtle and store it in the variable ’t'.
 
The colours red and dark red are used. We can define them here in a list
 
Now as you saw in the animation. the code draws a line and then takes a turn
And then draws a line again.
Each line is drawn longer than the line before.
 
We can use a for loop here and loop about 400 times with the range function
 
With the forward function we draw a straight line.
The length of the line is defined by the value stored in the variable number
Since we are looping in the range from 0 to 400, we can re-use the variable for the length of the line
 
Next we need to define the angle. 
 
If we enter 90 here, this loop would create a square.
 
We don’t want to it to be a perfect corner, but slightly off so it creates the spiral effect
Finally spiral alternates between red and dark red
 
In one iteration of the loop we want to use red, the next iteration dark red and keep alternating like that in each iteration.
 
We defined a list with the colors
Red has an index number of 0 and dark red has an index number of 1
So one iteration we need to pass the index number 0 and the next 1
 
We can do that by use the operator modulo, which is the percentage sign
 
This operator returns the remainder of a division problem
 
To show you how this works, lets visualise what the operator does
 
If we want to divide 5 by 2 with the modulo, what python does is, it makes in this case groups of 2.
If it is no longer able to make a group of 2, it returns the remainder. In this case one

Here’s an example of 4 divided by 2 with the out come 0

And here’s an example of 1 divided by 2
 
the modulo groups the input figure by 2 and if it cannot make a group of 2 anymore, then it returns the remainder
 
That’s how we can switch back and forth between red and dark red
 
Finally let write turtle.done() to keep the screen open after the code is done running. 
And that’s it.


🦁 Who are you?
My name is Raza. I am 30. I am an IT - manager right now, but I’ve been an accountant for the majority of my career.
I’m in love with #Python :)

You can find me here:
📷 Instagram:   / razacodes  
📈 Twitter:   / razacodes  
—————————————————————————————

Goals for 2021
Training Python hours: 57/1000
Python/Django Projects: 2/30
Subscribers: 1999/10,000

—————————————————————————————-
#100SecondsOfCode
#pythonforbeginners #programming

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Python Turtle Graphics Tutorial for Absolute Beginners - Drawing a Spirographic

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

Complete Python Turtle Graphics Overview! (From Beginner to Advanced)

Complete Python Turtle Graphics Overview! (From Beginner to Advanced)

👩‍💻 Python for Beginners Tutorial

👩‍💻 Python for Beginners Tutorial

Python Turtle Graphics Introduction | Python Tutorials for Beginners #lec111

Python Turtle Graphics Introduction | Python Tutorials for Beginners #lec111

Please Master These 10 Python Functions…

Please Master These 10 Python Functions…

Похудей на 45 КГ, Выиграй $250,000!

Похудей на 45 КГ, Выиграй $250,000!

Making a Game in Python with No Experience

Making a Game in Python with No Experience

ООП На Простых Примерах | Объектно-Ориентированное Программирование

ООП На Простых Примерах | Объектно-Ориентированное Программирование

Учим Python за 1 час! #От Профессионала

Учим Python за 1 час! #От Профессионала

КУПИЛ 50 РОБЛОКС ПОСЫЛОК СО ВСЕГО ИНТЕРНЕТА! *ОЧЕНЬ КРУТО*

КУПИЛ 50 РОБЛОКС ПОСЫЛОК СО ВСЕГО ИНТЕРНЕТА! *ОЧЕНЬ КРУТО*

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]