Skip to main content

Posts

Showing posts from April, 2021

Ordered Vs Unordered Data Structures in Python

Python has multiple data structures like Lists, Tuples, Dictionaries, Sets, and more . Some of them are Ordered and some are Unordered. This article will discuss  Ordered Vs Unordered Data Structures in Python. Lists It is a collection of a mutable ordered sequence of elements and can be accessed through indexing and defined inside []. Each element inside a List is called an item. From the above example, it is clear that the list maintains a sequence in which elements are inserted. So, it is an ordered data structure in python. Tuples It is a collection of immutable ordered elements, which follows a sequence in which elements are inserted. It is defined inside () and accessed through indexing. The above example shows that Tuples are ordered data structure and follow the sequence of insertion. Dictionaries Collection of items, in which items are defined as key-value pair in {}. Dictionaries are ordered data structures in python. It can be accessed through a specific key. Each key is sep

Concepts of Functional Programming in Python with Examples

Functional programming it's not new jargon, it just is a style of writing programming and treating some values and some functions in a bit different way than we used to treat them in object-oriented programming. What is Functional Programming? Functional programming is a programming paradigm in which we evaluate the pure mathematical function as the principal method of computation. “What to solve” is more important in functional programming instead of “How to solve”.   Concepts of Functional Programming Now, every single programmer can debate in the world of functional programming whether this is functional or this is not but there are four core important things on which every single programmer is going to agree that yes these are part of functional programming. Pure functions: Pure Functions always produce the exact same output for the same argument irrespective of anything else. They have no side effects. Recursion: There is no “for” or “while” loop in functional languages. Recur