Friday, May 22, 2015

Python: Assignment statement



Abstract: Skills related to assignment statement


1.exchange the objects
>>> x=1
>>> y=20
>>> x, y = y , x
>>> print x, y
20 1

2. initiate a list with replicates
>>> a=[0]*10
>>> print a
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
















writing date: 20150522

No comments:

Post a Comment