Python vs Scratch

In order to illustrate the same task can be carried out using different programming languages here is my loop program in Scratch.

 

loopdrawing

 

 

 

 

 

 

 

And in Python

import turtle
import time
 
for x in range(0,72):
	turtle.left(5)
	for n in range(0,5):
		turtle.forward(150)
		turtle.left(90) 
time.sleep(60)

As mentioned before the time module is only included so a delay is included before the canvas is removed.

And Ruby (this works in kidsruby at least)

Turtle.draw do
 background white
 pencolor black
 
 72.times do 
  4.times do
     forward (100)
     turnright (90)
   end
 turnright(5)    
 end 
end

 

So you can do the same task in a very similar way in different languages.

3 thoughts on “Python vs Scratch

  1. Yeah adding that does kinda mess up the post topic but it was useful to add for illustrativer purposes if nothing else. 🙂 Please it was useful to you though. thanks.

Comments are closed.