Skip to main content

Hello Readers - Introduction


Hello Friends,

Following will be a series of short and sweet (err... may be not) posts about tricks and tips in python.

This will be mostly related to python but later on it can also include other technology related tips.

Thanks.

Comments

Popular posts from this blog

Generators in Python

One of the most commonly asked question in Python interviews is "Have you worked with generators? How and what was the need to use it?" This post will try to explore what are they how and why they are used? Basically, Generator in simple terms can be thought as the function which returns series of results instead of one single result. Syntactic difference between function and generator is, Generator uses "yield" keyword instead of "return" keyword. Generators give us an iterator(Something which we can loop on for ex. list or dictionary) so they can be used with looping constructs such as 'for' and 'while' loops. Example: # Define a generator. def generator(number): while True: number += 1 yield number # Use the generator. x = generator(5) # Now calling the decorator print("Calling generator:") x.next() print("Calling generator:")

Immutable vs Mutable Data structures.

Majorly used Data Structures in python are as follows: List Set Tuple Dictionary String Numbers(int, float, decimal) One of the major things in python discussed is whether the data structure is mutable or immutable. What do this terms mean? In simple terms, Immutable means value cannot be changed after it is assigned to a variable. Whereas, In  mutable data type value can be changed after assignment. Hmm, What ??? This is still not clear these are merely dictionary definitions I am blabbering. Amazon.in Widgets