example:1
x = 15
x = "Roman"
print(x)
Variable cannot start with a number
so the output of this program is ‘Roman’
A variable name must start with a letter or the underscore character.
A variable name cannot start with a number.
A variable name can only contain alpha-numeric characters and underscores (A-z,
0-9, and _).
Variable names are case-sensitive (abc, Abc and ABC are three different
variables).
The most important things is, it is case sensitive.
example:2
x = "Roman "
y = "is a Boy"
z = x + y
print(z)
Output: Roman is a Boy
in this case,'+' character used for adding one variable to another variable.
example:3
x = 2
y = 5
print(x + y)
Output: 7
'+' character used as mathmatical
operator.
Example:4
x = 56 #int type
y = "Roman" #string type
print(x + y)
Output: Error
one is 'int' type another is 'string' type ,we cannot add a string with
integer
Comments
Post a Comment