WEB DEVELOPER SITE
PHP7
 

Python variable type


In this chapter we learn python veritable and you can store integers, decimals or characters in these variables.


Creating Python variable

The equal sign(=) used to assign value to variables.

Python Python variables do not need explicit declaration to reserve memory space.

X=1
Y="Mac"
print(X)
print(Y)

Result:
5
Mac

Variable Name

Variable start with letter and underscore character.

Variable can't started with number


More advance example variable

combined with text and variable

Example

X = "OOP"
print("Python is + X")
Try it yourself »

If you combine with a string and a number what will be answer

Example

x = 2
y = "Mac"
print(x + y)
Try it yourself »