Python is completely object oriented
Python is completely object oriented, furthermore not "statically typed". You do not need toward declare variables before using them, or declare their type. Every variable in Python is an object.This post will go over a few basic types regarding variables.
Numbers:Python supports two types regarding numbers - integers furthermore floating point numbers. (It also supports complex numbers, which will not be explained in this post).
To define an integer, use the following syntax:
myint = 7
To define a floating point number, you may use one regarding the following notations:
myfloat = 7.0
myfloat = float(7)
Strings: Strings are defined either with a single quote or a double quotes.
mystring = 'hello'
mystring = "hello"
The difference between the two is that using double quotes makes it easy toward include apostrophes (whereas these would terminate the string if using single quotes)
mystring = "Don't worry about apostrophes"
There are additional variations at defining strings that make it easier toward include things such as carriage returns, backslashes furthermore Unicode characters. These are beyond the scope regarding this tutorial, but are covered in the Python documentation. Simple operators can be executed at numbers furthermore strings:one = 1
two = 2
three = one + two
hello = "hello"
world = "world"
helloworld = hello + " " + world
Assignments can be done at more than one variable "simultaneously" at the same line like this a, b = 3, 4
Mixing operators between numbers furthermore strings is not supported:
# This will not work!
print one + two + Hello World