Python’s built-in bin() method with examples
Among many highly useful built-in functions, bin() is also one of them. It was added in Python 2.6, and since then its support has not been deprecated or removed. It is similar to the hex() method which returns the hexadecimal form of the integer while this returns the binary form. bin(x): bin(x) returns the binary…
https://thecodingbot.com/pythons-built-in-bin-method-with-examples/
Among many highly useful built-in functions, bin() is also one of them. It was added in Python 2.6, and since then its support has not been deprecated or removed. It is similar to the hex() method which returns the hexadecimal form of the integer while this returns the binary form. bin(x): bin(x) returns the binary…
https://thecodingbot.com/pythons-built-in-bin-method-with-examples/
The Coding Bot
Python's built-in bin() method with examples - The Coding Bot
Among many highly useful built-in functions, bin() is also one of them. bin(x) returns the binary string representation of the integer passed to it...
Convert a binary number(base 2) to the integer(base 10) in Python
Python has hundreds of utility functions that are built-in which ease our efforts to a great extent. Today, the problem we have in hand “Conversion of a binary number to its integer form(base 10)“, python has some built-in methods for this as well. In this article, we will go through different ways we can convert…
https://thecodingbot.com/convert-a-binary-numberbase-2-to-the-integerbase-10-in-python/
Python has hundreds of utility functions that are built-in which ease our efforts to a great extent. Today, the problem we have in hand “Conversion of a binary number to its integer form(base 10)“, python has some built-in methods for this as well. In this article, we will go through different ways we can convert…
https://thecodingbot.com/convert-a-binary-numberbase-2-to-the-integerbase-10-in-python/
The Coding Bot
Convert a binary number(base 2) to the integer(base 10) in Python - The Coding Bot
In this article, we will go through different ways we can convert the binary representation to the decimal representation in Python.
Python’s built-in hex() method with examples
In this tutorial, we will talk about hex(), another very useful Python utility method. It is pretty similar to bin(), the latter is used to find the binary representation of an integer, while the former converts the integer to its hexadecimal string format. We talked about built-in bin() function here. Have a read. hex(x): Syntax:…
https://thecodingbot.com/pythons-built-in-hex-method-with-examples/
In this tutorial, we will talk about hex(), another very useful Python utility method. It is pretty similar to bin(), the latter is used to find the binary representation of an integer, while the former converts the integer to its hexadecimal string format. We talked about built-in bin() function here. Have a read. hex(x): Syntax:…
https://thecodingbot.com/pythons-built-in-hex-method-with-examples/
The Coding Bot
Python's built-in hex() method with examples - The Coding Bot
hex() is a built-in utility function in Python, it returns a string representing the hexadecimal representation of the integer x.
Python’s built-in dict() method with examples
What is a dictionary in Python? A dictionary is a collection which is unordered, mutable and indexed. Mutable here means the values can be changed after it is initialized. It is basically a set of key:value pairs with a condition that no two keys are same. dict() is a built-in method and also a constructor…
https://thecodingbot.com/pythons-built-in-dict-method-with-examples/
What is a dictionary in Python? A dictionary is a collection which is unordered, mutable and indexed. Mutable here means the values can be changed after it is initialized. It is basically a set of key:value pairs with a condition that no two keys are same. dict() is a built-in method and also a constructor…
https://thecodingbot.com/pythons-built-in-dict-method-with-examples/
The Coding Bot
Python's built-in dict() method with examples - The Coding Bot
A dictionary is a collection which is unordered, mutable and indexed. In this article, we will discuss dict() with examples.
Remove duplicate rows from a Pandas Dataframe
Problem Statement: Given a Pandas dataframe, remove the duplicate rows. Solution: There are certain functions available to remove duplicates or identify duplicated in the dataframe in Pandas. One such function is df.duplicated() and the other function is df.drop_duplicates(). df.duplicated() not exactly removes duplicates from the dataframe but it identifies them. It returns a boolean series,…
https://thecodingbot.com/remove-duplicate-rows-from-a-pandas-dataframe/
Problem Statement: Given a Pandas dataframe, remove the duplicate rows. Solution: There are certain functions available to remove duplicates or identify duplicated in the dataframe in Pandas. One such function is df.duplicated() and the other function is df.drop_duplicates(). df.duplicated() not exactly removes duplicates from the dataframe but it identifies them. It returns a boolean series,…
https://thecodingbot.com/remove-duplicate-rows-from-a-pandas-dataframe/
The Coding Bot
Remove duplicate rows from a Pandas Dataframe - The Coding Bot
Remove the duplicate rows from a Pandas Dataframe using df.drop_duplicates() and df.duplicated() with filtering using boolean indexing.
How to find the digital root of a non-negative integer
Problem Statement: Given a non-negative integer find it’s digital root (repeated digital sum). Example: DigitalRoot(1335) = 1 + 3 + 3 + 5 = 12 = 1 + 2 = 3. Solution: Before moving forward with the approaches, let’s us see what digital root is. Digital Root (or Repeated Digital Sum): It is a single digit value obtained…
https://thecodingbot.com/how-to-find-the-digital-root-of-a-non-negative-integer/
Problem Statement: Given a non-negative integer find it’s digital root (repeated digital sum). Example: DigitalRoot(1335) = 1 + 3 + 3 + 5 = 12 = 1 + 2 = 3. Solution: Before moving forward with the approaches, let’s us see what digital root is. Digital Root (or Repeated Digital Sum): It is a single digit value obtained…
https://thecodingbot.com/how-to-find-the-digital-root-of-a-non-negative-integer/
The Coding Bot
How to find the digital root of a non-negative integer - The Coding Bot
3 Approaches to find the digital root of a number. Given a non-negative integer find it's digital root (repeated digital sum).
IPython/Jupyter notebook keyboard shortcuts
Table of Content: OverviewDifferent Types of mode in Jupyter NotebookCommand Mode shortcutsEdit Mode shortcutsCommon shortcuts Jupyter notebooks(previously known as Ipython Notebook) is an opensource interactive web application that allows us to write and run python codes and also create visualization, equations and markdowns. It is one of the most popular tools used in data analysis…
https://thecodingbot.com/ipython-jupyter-notebook-keyboard-shortcuts/
Table of Content: OverviewDifferent Types of mode in Jupyter NotebookCommand Mode shortcutsEdit Mode shortcutsCommon shortcuts Jupyter notebooks(previously known as Ipython Notebook) is an opensource interactive web application that allows us to write and run python codes and also create visualization, equations and markdowns. It is one of the most popular tools used in data analysis…
https://thecodingbot.com/ipython-jupyter-notebook-keyboard-shortcuts/
The Coding Bot
IPython/Jupyter notebook keyboard shortcuts - The Coding Bot
Jupyter notebook is a powerful tool for data analysis.It is good to know the keyboard shortcuts as it can save our time and efforts.In this article...
Python’s built-in bool() with examples
Python provides many built-in functions/methods which ease many cumbersome tasks. One such method is bool(). In this article, we will talk about bool(), its syntax, what parameters it takes and some examples demonstrating its use. bool(x) bool(x) converts the object, x, to a boolean value. What value it will return, True or False, totally depends…
https://thecodingbot.com/pythons-built-in-bool-with-examples/
Python provides many built-in functions/methods which ease many cumbersome tasks. One such method is bool(). In this article, we will talk about bool(), its syntax, what parameters it takes and some examples demonstrating its use. bool(x) bool(x) converts the object, x, to a boolean value. What value it will return, True or False, totally depends…
https://thecodingbot.com/pythons-built-in-bool-with-examples/
The Coding Bot
Python's built-in bool() with examples - The Coding Bot
In this article, we will talk about python's built-in bool(), its syntax, what parameters it takes and some examples demonstrating its use...
Different type of looping in Python
Table of Content: OverviewWhile loopDescriptionSyntax and ExamplesBreak statementContinue statementElse statementFor looprange()range(x)range(start,end)range(start,end,step)xrange()Difference between xrange() and range() In programming, a loop is a sequence of instructions that are continuously repeated until certain condition(s) is(are) met. The condition is often known as the terminating condition. In python, the Loops are broadly classified into two types – For loop…
https://thecodingbot.com/different-type-of-looping-in-python/
Table of Content: OverviewWhile loopDescriptionSyntax and ExamplesBreak statementContinue statementElse statementFor looprange()range(x)range(start,end)range(start,end,step)xrange()Difference between xrange() and range() In programming, a loop is a sequence of instructions that are continuously repeated until certain condition(s) is(are) met. The condition is often known as the terminating condition. In python, the Loops are broadly classified into two types – For loop…
https://thecodingbot.com/different-type-of-looping-in-python/
The Coding Bot
Different type of looping in Python - The Coding Bot
In this article, we will talk about for and while loop. Under for loop, we will discuss about range(), xrange() and other important functions
Python’s built-in all() method with examples
The Python interpreter has a number of functions and types built into it that are always available. One such method is all(). In this tutorial, we will talk about all() – its syntax, what parameter it takes, what is returns and some examples demonstrating its use. all() all(x) returns True if all elements of the iterable are…
https://thecodingbot.com/pythons-built-in-all-method-with-examples/
The Python interpreter has a number of functions and types built into it that are always available. One such method is all(). In this tutorial, we will talk about all() – its syntax, what parameter it takes, what is returns and some examples demonstrating its use. all() all(x) returns True if all elements of the iterable are…
https://thecodingbot.com/pythons-built-in-all-method-with-examples/
The Coding Bot
Python's built-in all() method with examples - The Coding Bot
all() is a built-in method, returns True if all elements of the iterable are true (or if the iterable is empty), otherwise false.
Python’s built-in any() method with examples
Table of Content: OverviewSyntax and description Examples using any()Time Complexity of the function Python interpreter has a bunch of methods and types built into it. The methods are known as built-in methods. any() is one such method and in a way, you can say it is the sister method of all(). In this tutorial, we…
https://thecodingbot.com/pythons-built-in-any-method-with-examples/
Table of Content: OverviewSyntax and description Examples using any()Time Complexity of the function Python interpreter has a bunch of methods and types built into it. The methods are known as built-in methods. any() is one such method and in a way, you can say it is the sister method of all(). In this tutorial, we…
https://thecodingbot.com/pythons-built-in-any-method-with-examples/
The Coding Bot
Python's built-in any() method with examples - The Coding Bot
any() is a built-in method, returns True if atleast one element of the iterable is true, otherwise false. If the iterable is empty, it returns false.
Deleting a linked list in C++
Problem Statement: Given a linked list, write a program to delete it. Example: Linked List: 2->4->6->9 *After Deletion* Output: The Linked List is Empty. Before moving forward, it is necessary to clarify what we actually mean by deletion of the linked list. Deletion of the linked list is not simply pointing the head of the…
https://thecodingbot.com/deleting-a-linked-list-in-c/
Problem Statement: Given a linked list, write a program to delete it. Example: Linked List: 2->4->6->9 *After Deletion* Output: The Linked List is Empty. Before moving forward, it is necessary to clarify what we actually mean by deletion of the linked list. Deletion of the linked list is not simply pointing the head of the…
https://thecodingbot.com/deleting-a-linked-list-in-c/
The Coding Bot
Deleting a linked list in C++ - The Coding Bot
Problem Statement: Given a linked list, design a program to delete it. Deletion means deallocating the space allocated to all its node, and then pointing the head to NULL.
Python’s built-in chr() function with examples
In this tutorial, we will talk about one useful built-in method, and that method is chr(). Built-in methods are the utility methods provided by the Python interpreter for our use, they come along when you install Python in your environment. It help us to skip implementing many common operations like converting an integer to binary…
https://thecodingbot.com/pythons-built-in-chr-function-with-examples/
In this tutorial, we will talk about one useful built-in method, and that method is chr(). Built-in methods are the utility methods provided by the Python interpreter for our use, they come along when you install Python in your environment. It help us to skip implementing many common operations like converting an integer to binary…
https://thecodingbot.com/pythons-built-in-chr-function-with-examples/
The Coding Bot
Python's built-in chr() function with examples - The Coding Bot
chr(x) is a built-in method in Python, it returns the string representing a character whose Unicode code point is the integer x.
Convert an octal number(base 8) to its decimal(base 10) representation in Python
Python’s built-in functions are the real deal when it comes to ease many tasks to a great extent, and that’s why I am a big fan of Python. What are built-in functions in Python? Built-in methods are the utility methods provided by the Python interpreter for our use, they come along when you install Python…
https://thecodingbot.com/convert-an-octal-numberbase-8-to-its-decimalbase-10-representation-in-python/
Python’s built-in functions are the real deal when it comes to ease many tasks to a great extent, and that’s why I am a big fan of Python. What are built-in functions in Python? Built-in methods are the utility methods provided by the Python interpreter for our use, they come along when you install Python…
https://thecodingbot.com/convert-an-octal-numberbase-8-to-its-decimalbase-10-representation-in-python/
The Coding Bot
Convert an octal number(base 8) to its decimal(base 10) representation in Python - The Coding Bot
In this blogpost, we will discuss different ways we can convert the octal representation of a number to the decimal equivalent. One approach uses built-in functions while other approach is pure algorithmic...
Find the element that appears once while all the other element appears twice in an array
Problem Statement: Given an array of numbers, all the elements appear twice except one, you need to find that number. Solution: This is a pretty famous interview question and is generally asked either in telephonic interviews or first round. Not that hard problem but the most efficient method to solve this problem is not very obvious. So, either…
https://thecodingbot.com/find-the-element-that-appears-once-while-all-the-other-element-appears-twice-in-an-array/
Problem Statement: Given an array of numbers, all the elements appear twice except one, you need to find that number. Solution: This is a pretty famous interview question and is generally asked either in telephonic interviews or first round. Not that hard problem but the most efficient method to solve this problem is not very obvious. So, either…
https://thecodingbot.com/find-the-element-that-appears-once-while-all-the-other-element-appears-twice-in-an-array/
The Coding Bot
Find the element that appears once while all the other element appears twice in an array - The Coding Bot
Problem Statement: Given an array of numbers, all the elements appear twice except one, you need to find that number.
Insert a node in a sorted linked list
Problem Statement: Given a sorted linked list and a node, insert the node in the linked list such that the linked list still remain sorted. Example: Input: 2 -> 8 -> 12 -> 41 ->NULL, val = 30 Output: 2 -> 8 -> 12 -> 30 ->41 -> NULL. Table of Content: OverviewApproach 1: Insertion…
https://thecodingbot.com/insert-a-node-in-a-sorted-linked-list/
Problem Statement: Given a sorted linked list and a node, insert the node in the linked list such that the linked list still remain sorted. Example: Input: 2 -> 8 -> 12 -> 41 ->NULL, val = 30 Output: 2 -> 8 -> 12 -> 30 ->41 -> NULL. Table of Content: OverviewApproach 1: Insertion…
https://thecodingbot.com/insert-a-node-in-a-sorted-linked-list/
The Coding Bot
Insert a node in a sorted linked list - The Coding Bot
Problem Statement: Given a sorted linked list and a node, insert the node in the linked list such that the linked list still remain sorted.
Insert a Node at the beginning of a Linked List
Problem Statement: Given a linked list(can be an empty list), add a node at the beginning of it. Solution: Table of Content: OverviewApproach 1: Iteratively adding the node at the beginningSteps in detailImplementation of Approach 1Time and Space Complexity discussion.Some more tutorials on the linked list This is a very famous interview question which you…
https://thecodingbot.com/insert-a-node-at-the-beginning-of-a-linked-list/
Problem Statement: Given a linked list(can be an empty list), add a node at the beginning of it. Solution: Table of Content: OverviewApproach 1: Iteratively adding the node at the beginningSteps in detailImplementation of Approach 1Time and Space Complexity discussion.Some more tutorials on the linked list This is a very famous interview question which you…
https://thecodingbot.com/insert-a-node-at-the-beginning-of-a-linked-list/
The Coding Bot
Insert a Node at the beginning of a Linked List - The Coding Bot
Problem Statement: Given a linked list(can be an empty list), add a node at the beginning of it ...
Python’s built-in id() method with examples
In this tutorial, we will talk about a built-in method, and that method is id(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns. After the discussion, we will see some examples for better understanding. Table of Contents: OverviewWhat are the built-in methods in Python?OverviewThe lifetime…
https://thecodingbot.com/pythons-built-in-id-with-examples/
In this tutorial, we will talk about a built-in method, and that method is id(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns. After the discussion, we will see some examples for better understanding. Table of Contents: OverviewWhat are the built-in methods in Python?OverviewThe lifetime…
https://thecodingbot.com/pythons-built-in-id-with-examples/
The Coding Bot
Python's built-in id() method with examples - The Coding Bot
In this article, we will discuss about built-in id() method in Python. It returns the "identity" of an object an integer which is unique and constant for an object during its lifetime..
Python’s built-in len() method with examples
Python has many built-in functions. In this article, we will talk about one such function and that function is len(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns. After the discussion, we will see some examples for better understanding. Table of Content: OverviewDiscussion on…
https://thecodingbot.com/pythons-built-in-len-method-with-examples/
Python has many built-in functions. In this article, we will talk about one such function and that function is len(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns. After the discussion, we will see some examples for better understanding. Table of Content: OverviewDiscussion on…
https://thecodingbot.com/pythons-built-in-len-method-with-examples/
The Coding Bot
Python's built-in len() method with examples - The Coding Bot
In this article, we will discuss about python's built-in len() function. len() determines the size(number of items) of an object..
Time Complexity of built-in len() function in Python
In this article, we will explicitly focus on the Time Cost of len() function. It is used pretty often, but still, people often get confused about the time complexity of the function. You can find the complete tutorial on the built-in len() function here. Before moving forward, let’s see briefly what len() function does. The…
https://thecodingbot.com/time-complexity-of-built-in-len-function-in-python/
In this article, we will explicitly focus on the Time Cost of len() function. It is used pretty often, but still, people often get confused about the time complexity of the function. You can find the complete tutorial on the built-in len() function here. Before moving forward, let’s see briefly what len() function does. The…
https://thecodingbot.com/time-complexity-of-built-in-len-function-in-python/
The Coding Bot
Time Complexity of built-in len() function in Python - The Coding Bot
In this article, we will discuss about the time complexity of the len() function in Python. It is return the size of the container..
Delete an element from the Python list
Lists are probably python’s most versatile and used data structures. You will find it them in a significant number of python programs. It is also a mutable object. Mutable Object – The Python objects whose value can be changed after initialization without changing its identity are known as Mutable Python Object. In this tutorial, you will…
https://thecodingbot.com/delete-an-element-from-the-python-list/
Lists are probably python’s most versatile and used data structures. You will find it them in a significant number of python programs. It is also a mutable object. Mutable Object – The Python objects whose value can be changed after initialization without changing its identity are known as Mutable Python Object. In this tutorial, you will…
https://thecodingbot.com/delete-an-element-from-the-python-list/
The Coding Bot
Different ways to delete an element from the Python list - The Coding Bot
In this article, I will show you the different ways we can delete an element from the Python list. Later, we will also see how to remove all the occurence of an element from the list.