DEV Community


Posted on

Let's create corona virus using python

Welcome to the wild and wacky world of turtle graphics! Today, we're going to explore the world of turtle programming by creating a fun, virus-like image.

Full Code:

import turtle
b = 200
while b > 0:
    b = b - 1

Enter fullscreen mode Exit fullscreen mode

First, we're going to import the turtle module and set the speed to 40. This means that the turtle will move quickly, creating a cool, dynamic effect. Next, we're going to set the color to cyan and the background color to black. This creates a cool, neon-like effect that will make our virus stand out.

Now comes the fun part: the while loop. This loop will run as long as the variable "b" is greater than 0. Inside the loop, we're going to have the turtle move left by the value of "b", then move forward by "b" times 3. Finally, we'll decrease the value of "b" by 1.

As the loop runs, the turtle will create a spiral-like pattern that looks like a virus spreading and infecting the screen. And with the high speed of turtle movement, this effect is amplified and looks dynamic.

As the loop runs, you'll notice the spiral getting smaller and smaller. This is because we're decreasing the value of "b" by 1 each time the loop runs. Finally, when "b" is equal to 0, the loop will stop running, and our virus-like image will be complete!

Corona Virus

In conclusion, turtle graphics is a fun and easy way to create cool, dynamic images. This little program can be used as a base to make more complex graphics, Or used to make cool animation with multiple turtle and different shapes. Give it a try and unleash your inner artist!

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.