Previous Lecture Complete and continue  

  Lesson 5: String

What is a string? When you want something to show up EXACTLY how you want it... Go with a string.

A string is the thing in quotes (Single quotes or double quotes, it doesn't matter as long as it's consistent).
So,

"HELLO HI HOW ARE YOU" ==> is a string
HELLO HI HOW ARE YOU ==> is a big fat error.

8 comments
shane
why does it work like. "hello world" as well as
print "hello world" silly question maybe?
PaRuSch
Hey shane,
good question and I try to answer it as good as I can.
It works in the python console because it will just repeat the string.
When you use print("Hello world") it will show as Hello world. But if you tell the console "Hello world" It will answer with 'Hello world'.

We need to use the print function if we want to run code, which means if you have a file (lets say you named it hello_world.py) and you wanna run it, you need to tell the compiler what to do. If you then just use "Hello world" nothing would happen, BUT if you do use print("Hello world") it will compile and tell you Hello world.
Miroslav
https://repl.it/EzTj/0

:)
Aman Tyagi
haha.. that was cool and correct!
Richard Franck
what's wrong with this code?
import turtle

turtle = turtle.Turtle()

fore = turtle.forward(100)
left = turtle.left(90)
right = turtle.right(90)

fore
left
fore
right
fore
hamied amr
fore,left are variables not orders variables is container of data place can save the value on it so u can't do some thing like that(fore = turtle.forward(100) because this line means that u tell python hey put the value of (turtle.forward(100)) on some variable called fore
i hope u understand me
Ereatara Kokiri
strings are awesome
prudhvi kandregula
import turtle
my_dog=turtle.Turtle()
my_dog.forward(100)
my_dog.right(90)
my_dog.forward(100)
my_dog.right(90)
my_dog.forward(100)
my_dog.right(90)
my_dog.forward(100)