Draw Virus Using Python Turtle With Code
Last updated June 12, 2023 by Jarvis Silva
In this tutorial we will see how to draw virus with python, We will use the turtle module to draw this virus, Turtle is a GUI library with the help of this library you can draw anything in python.
Python Code To Draw Virus
import turtle as t
t.speed(10)
t.color('yellow')
t.bgcolor('black')
b = 200
while b > 0:
t.left(b)
t.forward(b * 3)
b = b - 1
t.done()
Above is the python code for drawing the virus, below is a simple explaination of how this code works:
- Import the turtle module and rename it as ‘t’.
- Set the drawing speed of the turtle to 10.
- Set the pen color to yellow and the background color to black.
- Set the variable ‘b’ to 200.
- Enter a while loop that continues until ‘b’ becomes 0.
- Inside the loop, turn the turtle left by the value of ‘b’ degrees.
- Move the turtle forward by ‘b’ multiplied by 3 units.
- Decrement the value of ‘b’ by 1.
- Repeat steps 6-8 until ‘b’ reaches 0.
Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer or use this online python compiler.
After you run the program it will open a new window and it will start drawing Virus and below is the finished drawing.
As you can see, we successfully drew a virus, I hope you found this program helpful and useful, do share it with your friends who are intrested in programs like this.
Here are some more python drawing tutorials for you:
- Draw Pikachu using python with code.
- Draw doraemon using python turtle.
- Draw shinchan using python turtle.
- Draw I love you using python turtle.
- Draw Batman logo using python turtle.
- Draw Google Logo using python turtle.
- Make a python calculator using turtle.
- Draw christmas tree using python.
- Draw spiderman in python programming.
- Draw Python Logo Using Python.
- Draw Iron Man using python turtle with code.
- Draw A Heart Using python turtle with code.
- Draw car in python turtle with code.
- Draw a Cat In Python Turtle With Code.
- Draw Panda In Python Turtle With Code.
- Draw Netflix Logo Using Python Turtle.
- Draw Whatsapp Logo Using Python Turtle.
- Draw Windows Logo Using Python.
- Draw Apple Logo Using Python Turtle.
- Draw YouTube Logo Using Python Turtle.
- Draw India Map In Python Turtle.
- Draw Snapchat Logo Using Python Turtle.
- Draw TikTok Logo Using Python.
- Draw Instagram Logo Using Python Turtle.
I hope you found what you were looking for from this tutorial, and if you want more python guides and tutorials like this, do join our Telegram channel for future updates.
Thanks for reading, have a nice day 🙂