Python variables Assignment - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Python variables Assignment - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Wednesday, November 28, 2018

Python variables Assignment

Python variables Assignment



Variables in Python

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.




code
#assignment=binding of a name with a value 
#1. evaluation of right side expression value
#2. assignment in order with left side names
x=1.2+8+sin(y)
a=b=c=0 #assignment to some value
y, z, r=9.2, -7.6, 0 #multiple assignment
a, b=b, a #values swap
a, *b=seq #unpacking of sequence in
*a, b=seq #item and list
x+=3 #increment=x=+3
x-=2 #decrement=x=x-2
x=None #undefined (constant value)
del x #remove name x

No comments:

Post a Comment

Post Top Ad