Variables, Print, Strings, Booleans, Integers and floats. Python Part 1
Learn how to use Variables and "Print()" and get know what they are and do
Once you are in your project, right-click on the file “(Your file’s name)“ and hover to “New" and select “Python file“. Name your file “Main” and then press Enter. Now type your first code:
print("Hello")
When you press the run button on the top (the one that looks like a play button), A new tab should open up. That’s called the Terminal, and there you can see your “Hello”.
Print
print(value)
print = To print something on the Terminal
value = something to print like for example: “Hello“
Note: When you want to print a Variable, write without any Quotations marks, and when it is a string (phrase like “Hello“), write it with the marks.
Strings
Strings are phrases with Quotation marks like: “Hi“; “Not now“; etc. It is also a Value
"value"
Booleans
Booleans are true or false statements.
True or False
Integers
Solid numbers without any points. Integer = 1, 2, 3, etc. Not Integers = 1.5, 3.96, etc.
int(value)
Floats
Numbers with or without points.
float(value)
Variables
A variable is, as the name applies, something that varies. Example: number = 5
Note: If your V. name has more than one word, use underscores to separate them, ex.: Computers_are_great = True
name of the Variable = value
To understand everything, here is a code of all the things above:
age = 33
name = "Adam"
is_adult = True
is_child = False
print(age)
print(name)
Exercises:
Code a program that prints “44“
Make a Variable with Booleans and Integers
Make a Variable containing a string and print that Variable
Please Subscribe! :) See you next time