Latest Posts From Safa Mulani

Python Add to Dictionary

Python Dictionary basically contains elements in the form of key-value pairs. It is an unordered collection of items. Creation of Dictionary: Output: How to Add to Dictionary in Python By using update() method By using _setitem_() method By using subscript notation By using “*” operator 1. By Using update() Method The update() method enables the […]

Python Set Intersection

Python Set Intersection basically finds and returns elements common among the sets. Syntax: set1.intersection(set2) is equivalent to set1 ∩ set2. Arguments: Accepts one or more sets as an argument. Return Value: Returns a set as output which contains elements common to all the sets. Ways to achieve Set Intersection in Python Either of the following […]

Python print() function

Python print() function basically prints the given input or object to the output screen or the corresponding stream file. Syntax: Python print() function Arguments: Arguments Description Required/Optional object(s) An object or input string Required sep=’value‘ Specification on how the objects are to be separated.Default separator value is ‘ ‘ Optional end=’end_value’ Specifies what is to […]

Python input() function

It often happens that the developers/programmers need to accept the input from the user to process further with the application. Python provides a built-in-method to accept the input from the user. Python input() function accepts the input from the user. Python’s builtins.py contains the Python input() function. Syntax: The prompt is optional in the input() […]

Python zip() Function

Python zip() function stores data inside it. This function accepts iterable elements as input and returns an iterable as the output. If no iterable elements are provided to the python zip function, it returns an empty iterator. It thus aggregates elements from the iterables and returns iterables of tuples. Python Zip() Function Syntax: Python zip() […]

Python Reverse List

Python provides multiple ways to reverse the elements in a list. Python Reverse List Elements The following techniques can be used to reverse a Python List: By using the reversed() function By using the reverse() function By using Slicing technique By using for loop and range() function 1. reversed() function The reversed() method creates a […]