PYTHON BUILD-IN FUNCTIONS

LEN() Len function take an iterable object and returns the numbers of items in an object. Example: >>items = [1,2,3,4] >>print(len(items)) Output :4 ZIP() Zip function can take nth iterable objects and return a zip object which is an iterator of tuples. Example: >>ids=[1,2,3] >>names=[‘a’,’b’,’c’] zipobj=zip(ids,names) print(list(z)) Output: [(1,’a’),(2,’b’)'(3,’c’)] ORD() Ord function return a number … Continue reading PYTHON BUILD-IN FUNCTIONS

ROCK PAPER SCISSORS IN PYTHON

Rock Paper Scissors, a very famous game which you might have enjoyed with your friends but now it is the time to enjoy the same game using Python. Rock paper scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are “rock”, … Continue reading ROCK PAPER SCISSORS IN PYTHON

MAGIC FUNCTIONS OF PYTHON

Have you ever heard about these three functions? map() filter() reduce() It is a part of functional programming. I call these as ‘MAGICAL FUNCTIONS’ because we can save the time and write shorter code. map(func, *iterables) map functions take two arguments as input. The first one is a function and second one is iterable object. … Continue reading MAGIC FUNCTIONS OF PYTHON

PYTHON FUNCTIONS AND DECORATORS

Python Decorator Python Decorator is a relative change that you do in Python syntax to adjust the functions quickly. Any sufficiently generic functionality you can “tack on” to an existing class or function’s behavior makes a great use case for decoration. This includes: logging, enforcing access control and authentication, instrumentation and timing functions, rate-limiting, caching; … Continue reading PYTHON FUNCTIONS AND DECORATORS

Design a site like this with WordPress.com
Get started