A python tutorial
HappyLunchBox (42)

My Python tutorial :)

What you are going to learn today

  • comments and printing
  • variables
  • and anything I can fit into this tutorial

You should try this tutorial if you feel like this isn't enough

Ok, let's start with printing and comments.

comments are like this:


they don't have much use, you can just use them like sticky notes, the computer doesn't read them.

print("Hello World!")
You don't need to do ; semicolons like some other languages.

So this is how it works.
It shows whatever is in the print("") onto the console. If you have done other languages it's println, writln, System.out.println etc.

Try printing out Hi!

Answer: print("Hi!")
Make sure not to do Print("Hi") (print is capitalized), and don't forget the double quotes. Only if you want to print variables, do you not do the double quotes. You can also use single quotes to print a single character/letter. Like this:

although print("c") and print('adjaidjoais dsfjdosf dsfijdisf') also works.


You can just declare varibales like this:

varX = 5
What it does:
It assigns a variable called varX to a number, 5.
The computer then prints the value of varX.
Unlike some other languages (java), you don't need to put int or String or char or double or anything to specify the variable.

You can also do this:

n = 5
n = 3

but n will be 3, not 5

Ok, your assignment is to make a variable called my_number and assign it to 3, and then print it out.


my_number = 3

Now let's move on to inputs.
Inputs ask users for information, and can store the information when the input is assigned to a variable.


v = input("How are you?")
So, v is what the user inputs when they see
How are you?
this is what shows on the console
How are you?
and maybe the user inputs "good"
How are you?good
so then v would be equal to good.

Ok, that's all for this tutorial, I may make another tutorial if I have time and I'm bored. There is much more to python, like lists, definitions, dictionaries etc. Those are the things I'm gonna focus on in the next tutorial that I may make.

You are viewing a single comment. View All
HappyLunchBox (42)

oops comments are actually #comment I forgot to add that for some reason