Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22464

Vasudev Ram: Analyse this Python code snippet

$
0
0
By Vasudev Ram

Hi reader [1],

Analyze the snippet of Python code below. See what you make of it.

I will discuss it in my next post.

>>> a = 1
>>> lis = [a, 2 ]
>>> lis
[1, 2]
>>> lis = [a, 2 ,
... "abc", False ]
>>>
>>> lis
[1, 2, 'abc', False]
>>> a
1
>>> b = 3
>>> lis
[1, 2, 'abc', False]
>>> a = b
>>> a
3
>>> lis
[1, 2, 'abc', False]
>>> lis = [a, 2 ]
>>> lis
[3, 2]
>>>

[1] This product is suitable for Pythonistas aged 1 to 2 (approximately). For those of higher age, the dose may have no effect :)

- Vasudev Ram - Online Python training and consulting

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter




Viewing all articles
Browse latest Browse all 22464

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>