Previous Lecture Complete and continue  

  Lesson 4: Variables

What the heck are variables? Well, watch the video and find out.

34 comments
Shariyar Abeer
import turtle
bob=turtle.Turtle()

for i in range(100):
bob.forward(i*30)
bob.right(123)

mark wendell aquino
thanks
HIMANSHU PUJARI
X=100
Y=200
my_name=( " HIMANSHU ")
print(X*X)
print(X*my_name)
Sunitha M
https://repl.it/FJp2/0
Sunitha M
import turtle
color=turtle.Turtle()
color.pencolor("blue")
for i in range(150):
color.forward(i*1)
color.left(90)

Cameron McKee
Haha, variables are vari simple :P
Salum Toky
hahahahaha nice one
ritu uddin
hi :D
can u tell me where is the run button in the windows version? (3.5.3)
phil Boormantuck
import turtle


my_turtle = turtle.Turtle()


def square(length,angle):
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
for i in range(4):
square(100,90)
Joseph Victor Swedlund
#Cool rectangle code

import turtle
angle = 90
#You can change the base and height!
base = 100
height = 150

turtle = turtle.Turtle()

turtle.forward(base)
turtle.left(angle)
turtle.forward(height)
turtle.left(angle)
turtle.forward(base)
turtle.left(angle)
turtle.forward(height)
Václav Kokotek
import turtle
t = turtle.Turtle()
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.left(45)
t.forward(141.4213562373095)
t.left(90)
t.forward(70.710678118654752440084436210485)
t.left(90)
t.forward(70.710678118654752440084436210485)
t.left(90)
t.forward(141.4213562373095)


...house :O
Kannan Priyadharshan
import turtle
my_turtle = turtle.Turtle()
my_turtle.forward(20*5)
my_turtle.left(90)
my_turtle.forward(20*5)
my_turtle.left(90)
my_turtle.forward(20*5)
my_turtle.left(90)
my_turtle.forward(20*5)

roshan thushara
Crazy stuff.amazing
Serdar Guler
░░░░█▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░░░█▒▒▄▀▀▀▀▀▄▄▒▒▒▒▒▒▒▒▒▄▄▀▀▀▀▀▀▄
░░▄▀▒▒▒▄█████▄▒█▒▒▒▒▒▒▒█▒▄█████▄▒█
░█▒▒▒▒▐██▄████▌▒█▒▒▒▒▒█▒▐██▄████▌▒█
▀▒▒▒▒▒▒▀█████▀▒▒█▒░▄▒▄█▒▒▀█████▀▒▒▒█
▒▒▐▒▒▒░░░░▒▒▒▒▒█▒░▒▒▀▒▒█▒▒▒▒▒▒▒▒▒▒▒▒█
▒▌▒▒▒░░░▒▒▒▒▒▄▀▒░▒▄█▄█▄▒▀▄▒▒▒▒▒▒▒▒▒▒▒▌
▒▌▒▒▒▒░▒▒▒▒▒▒▀▄▒▒█▌▌▌▌▌█▄▀▒▒▒▒▒▒▒▒▒▒▒▐
▒▐▒▒▒▒▒▒▒▒▒▒▒▒▒▌▒▒▀███▀▒▌▒▒▒▒▒▒▒▒▒▒▒▒▌
▀▀▄▒▒▒▒▒▒▒▒▒▒▒▌▒▒▒▒▒▒▒▒▒▐▒▒▒▒▒▒▒▒▒▒▒█
▀▄▒▀▄▒▒▒▒▒▒▒▒▐▒▒▒▒▒▒▒▒▒▄▄▄▄▒▒▒▒▒▒▄▄▀
▒▒▀▄▒▀▄▀▀▀▄▀▀▀▀▄▄▄▄▄▄▄▀░░░░▀▀▀▀▀▀
▒▒▒▒▀▄▐▒▒▒▒▒▒▒▒▒▒▒▒▒▐
▒█▀▀▄ █▀▀█ █▀▀█ █▀▀█   ▀▀█▀▀ █░░█ █▀▀   ▒█▀▀█ █▀▀█ █▀▀ █▀▀
▒█░▒█ █▄▄▀ █░░█ █░░█   ░▒█░░ █▀▀█ █▀▀   ▒█▀▀▄ █▄▄█ ▀▀█ ▀▀█
▒█▄▄▀ ▀░▀▀ ▀▀▀▀ █▀▀▀   ░▒█░░ ▀░░▀ ▀▀▀   ▒█▄▄█ ▀░░▀ ▀▀▀ ▀▀▀
║████║░░║████║████╠═══╦═════╗
╚╗██╔╝░░╚╗██╔╩╗██╠╝███║█████║
░║██║░░░░║██║╔╝██║███╔╣██══╦╝
░║██║╔══╗║██║║██████═╣║████║
╔╝██╚╝██╠╝██╚╬═██║███╚╣██══╩╗
║███████║████║████║███║█████║

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

________________________________
| Windows Dialog                   [-] [口] [×] |
|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄  ̄ |
| Windows has detected that this song is awesome! |
| Do you agree?        |
|    ______    ______    _____   |
|    | Yes   |   | Maybe |     |   No  | |
|     ̄ ̄ ̄ ̄ ̄ ̄     ̄ ̄ ̄ ̄ ̄ ̄     ̄ ̄ ̄ ̄ ̄  |
|______________________________ __ _|

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█░░░░░░░░▀█▄▀▄▀██████░▀█▄▀▄▀██████
░░░░ ░░░░░░░▀█▄█▄███▀░░░ ▀█▄█▄███

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄

▀▀█▀▀ ▒█▀▀▀█ ▒█░▒█ ▒█▄░▒█ ░█▀▀█ ▒█▀▄▀█ ▀█▀ █ █ █
░▒█░░ ░▀▀▀▄▄ ▒█░▒█ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ▒█░ ▀ ▀ ▀
░▒█░░ ▒█▄▄▄█ ░▀▄▄▀ ▒█░░▀█ ▒█░▒█ ▒█░░▒█ ▄█▄ ▄ ▄ ▄
Saad Ahmad Khan
x = 10
y = 20
my_name = (" Saad ")
print (x*x)
print (y-x)
print ( my_name * x)
poonam ahir
done
Te Rauoriwa Wilson
Done
Aman Tyagi
https://repl.it/FJp2/0
Aman Tyagi
Guys, check this out! What do you think it is.. a sunflower or an alloy wheel or a piece of art?

https://repl.it/FIVE/1
Aman Tyagi
Bob is a GIANT KID. lol.
#inclasshumor
Robert de los santos
import turtle
q=turtle
my_q=q.Turtle()
my_q.forward(200)
my_q.left(90)
my_q.forward(200)
my_q.left(90)
my_q.forward(200)
my_q.left(90)
my_q.forward(200)
my_q.left(90)
Craig
import turtle
my_turtle=turtle.Turtle()
x = my_turtle
x.forward(100)
x.right(90)
x.forward(100)
x.right(90)
x.forward(100)
x.right(90)
x.forward(100)
x.right(90)
x.forward(100)
x.left(45)
x.forward(100)
x.left(145)
x.forward(35)
x.right(180)
x.forward(35)
x.right(90)
x.forward(35)
x.left(180)
x.forward(35)
x.right(50)
x.forward(10)
Mark Bergsma
import turtle


my_turtle = turtle.Turtle()
x = my_turtle
x.forward(100)
x.left(110)
x.forward(100)
x.right(110)
x.forward(100)
Md Abdullah Al Maruf
How was tht?

import turtle
x=turtle
m_x=x.Turtle()
m_x.forward(100)
m_x.left(90)
m_x.forward(100)
m_x.left(90)
m_x.forward(100)
m_x.left(90)
m_x.forward(100)
m_x.left(90)
Jonas Abarham
This doesn't work because you musst let space between equal and letters or something.
Ereatara Kokiri
awesome
Dallas Snook
dallas = "6 foot tall, likes sports, likes money"
Kshitij Dayal
Hey Qazi!
What do i need to do in this lesson exercise?
Fortune
variables
abc = "learning is really fun"
defe = 3
ghi = 10
print (abc)
for i in range(10):
print (abc)
print (i)
print (defe)
print (i*defe)
Rafeh Qazi
learning is fun I agree!!
gokulakrishnan
=============== RESTART: C:/Users/Hp/Desktop/practices/tur.py ===============
Traceback (most recent call last):
File "C:/Users/Hp/Desktop/practices/tur.py", line 1, in
import turtle
File "C:/Users/Hp/Desktop/practices\turtle.py", line 2, in
my_turtle=turtle.Turtle()
AttributeError: module 'turtle' has no attribute 'Turtle'




this is what happen when i run the command!
Rafeh Qazi
Don't name your file turtle.py. That is the problem that was happening to me too lol.
kenneth
i cant see the images
Rafeh Qazi
In the video or in the comments?