Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services. Python Variables and its types | Python tutorials Bestitworriors
Python Variables and its types
Python Variables and its types | Python tutorials Bestitworriors - Variables are the containers for storing data and information in itself that have different type of informations in it..Python support many types of variable like integer , float , string ,character etc.Python variables are case sensitive.Python variable name can't start with number.Python variable must start with letter or underscore character.Python variables name are case sensetive
Some Key Points of Python Variables
- Variable use to hold data and information
- Variable name must start with letter or underscore character
- Variable name can't start with number
- Variable name can only contain alpha numaric characer a-z ,1-9 and _character.
- Variabe name are case sensetive (name or NAME) are two different variable
- Global variable are those decleare outside the function globally but can be use inside of function
- Camel case variable first word letter is small other first letter large e.g myCamelCaseVariable
- Pacal case variable all words first caracter is capital eg. MyPascalCaseVariable
- Snake case variable all words merge with underscore character eg.my_snake_case_variable
Code
var1 = 5
var2 = "Best IT worriors"
print(var1)
print(var2)
x = str(3) # x will be '3'
y = int(3) # y will be 3
z = float(3) # z will be 3.0
#Variable Types
var3 = 5
var4 = "John"
print(type(var3))
print(type(var4))
#Both are different variables
com = 4
COM = "Sally"
print(com)
print(COM)
#Camel Case
myCamelCase = "Best It Worrior"
#Pascal Case
MyPascalCase = "Best It worrior"
#Snake Case
my_snake_case = "Best It worrior"
var5, var6, var7 = "Best", "IT", "Worrior"
print(var5)
print(var6)
print(var7)
#One Value to Multiple Variables
var8 = var9 = var10 = "Best of Luck"
print(var8)
print(var9)
print(var10)
#Output Variables
var11 = "Best It Worrior"
var12 = "is"
var13 = "awesome"
print(var11, var12, var13)
var14 = "Awesome Platform"
def MyFunction ():
print("Bestitworrior is " + var14)
MyFunction()
OutPut
5
Best IT worriors
int
str
4
Sally
Best
IT
Worrior
Best of Luck
Best of Luck
Best of Luck
Best It Worrior is awesome
Bestitworrior is Awesome Platform
Best IT worriors
int
str
4
Sally
Best
IT
Worrior
Best of Luck
Best of Luck
Best of Luck
Best It Worrior is awesome
Bestitworrior is Awesome Platform
0 Comments