Learn to Code via Tutorials on Repl.it!

← Back to all posts
A Beginner's Guide To Python 🐍
imightbenutella (3)

A Beginner’s Guide To Python

Hey there! 👋

I’m @imightbenutella, and I’m quite experienced at Python3 myself - and I want to share that! Python is the easiest computer language you can learn, whether you’re doing it for fun or for business (python is more commonly used in data managing - more on that later). The best part? Experience doesn’t matter

So what is Python?

No, I’m not talking about the snake. (hisssss 🐍)

Python is a computer language, and to save time, I’m going to skip the history lesson - partly because I don’t remember much about the history of Python myself…
Python is really helpful if you’re new to programming, and it’s code is easy to read and understand. In this article, I’m going to cover a few basics:

  • Variables
  • Print statements & strings
  • Comments
  • Booleans
  • Formatting strings, booleans and integers.

So let’s start :)


No ‘var’s here, just buckets! 👀🧺

I like to think of variables as buckets. How do you use a bucket? You put things in it. Similarly, variables are buckets for text, numbers and conditions - or if you want to be fancy, strings, integers and booleans. Anyway, if you’ve used JS (JavaScript) before, you’re probably familiar with variables - but there are no ‘var’s here!
Here’s how to make a variable:

variable = 8

So, above, we create the variable, variable (I am very creative). Inside variable, we stored the number/integer 8. Say, I want to do something with it. Maybe… add 2 in it? Let’s create a variable for 2 - and let’s make it longer. Obviously, I can’t go and type variable 2 = 2. That’ll cause an error. Instead, we type:

variable = 8
variable_2 = 2
add_both = variable + variable_2 

BOOM! We added variables! Umm.. just one problem. How do we see the result?

Print statements & strings

Strings of banan- sorry, text 🍌

Print statements make a variable, string, integer (number) or boolean appear in your console. A string contains text, and is wrapped in “” or ‘’. Like so - “Bananas are yellow” or ‘Bananas are yellow’. And here’s how to implement print - with our previous code.


And that prints 8 in the console. If you want to add two variables, here’s how to do it:

print(variable + variable_2)

Here’s a string variable:

string= “bananas are yellow”

And here’s how to add strings:

print(“bananas are “ + “yellow”)


Aliens can’t read the code 👽

If you create something for aliens, you need something to tell humans what a certain bit of code does. Comments are the way to do it. Let’s type up a comment:

# this is a comment!
#this is also a comment!



Python is easy.... True or False? ❓

Booleans are conditions - whether True or False. For example,

boolean = True

Easy, no?

Formatting strings, booleans and integers.

Imagine a bunch of cows, sheep and goats in one place… 🐐

Maybe you want to use strings and integers in one place. There is a way to do that. There are three ways to do this - bool(), str() and int(). Here’s how to use each.

string = “bananas are yellow ”
integer = 8
boolean = False
bool_str = str(boolean)
int_str = str(integer)
print(string + bool_str + int_str)
str_bool = bool(string) 
int_bool = bool(integer) 
print(boolean + str_bool + int_bool)
str_int = int(string) 
bool_int = int(boolean) 
print(integer + stri_int + bool_int)

This might be hard to understand… But remember, it’s all just buckets!

Signing off,

Have fun, and happy coding! 😃

DynamicSquid (4928)

Nice! One suggestion though, "bucket" might not be the right term since it implies a variable can store multiple values, but other than that this was a neat tutorial :)

DynamicSquid (4928)

@CodeLongAndPros one value as in one value at a time. a variable cannot store multiple values at once, unless it's an array or you're using a tuple or something like that

ch1ck3n (2077)

this only teaches variables