Variables and Types in Python

 

Variables and Types in Python

 

LEARN HOW TO USE VARIABLES IN PYTHON

In Python, every variable is an object i.e. Python is entirely “object-oriented”. You don’t have to declare variables or their type before using them.

 

 

Numbers

Two categories of numbers are supported by Python – integers and floating-point numbers. The third category of numbers “complex numbers” goes beyond the scope of this tutorial.


myint = 7
print(myint)

The output for this code is 7

 

 

Strings

The use of a single quote or a double quote defines a string.


mystring = 'hi'
print(mystring)
mystring = "fugen.ai"
print(mystring)

Try this code out.

 

 

numbers and string


one = 1
two = 2
three = one + two
print(three)

hi = "hi"
fugen = "fugen"
hifugen = hi + " " + fugen
print(hifugen)

Do you know what is the output here?