Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
3

Intro to Python

AriTelford1
AriTelford1

Introduction

Python is an easy language to learn with super easy syntax. Here's a basic program
print('Hello world')
This program is pretty self explanatory, but there's one important thing. Notice the single quotes. You can use double quotes or single quotes, but you won't be able to use them again. By that I mean you can't say
print("John said "Hello world" to the man")
because the python interpreter will go to the next quote and end there, thus creating an error. The same goes for single quotes.

Variables

Variables are very easy in python. First, write the name of it, then an equals sign, and the value. For example, you could say
variable = 'value'
To print this new variable, just use the print command we learned about
print(variable)
this will output value to the console.

That's all for now. I'll post another tutorial soon.

3 years ago

Voters

Comments

TopNew
1
AllAwesome497
AllAwesome497

Also- you can put quotation marks in a quoted string, you just need to use backslashes().
EG:
print("John said \"Hello, world\" and walked away.")

3 years ago
1
AriTelford1
AriTelford1

@AllAwesome497
I did not know that, thanks for sharing!

3 years ago
1

@AllAwesome497

Or use a mixture of paired single and double quotes e.g.
print("Hello 'Python'")

3 years ago
Load more