Python dictionary’s popitem() method with examples
Table of Contents Overviewpopitem() – Syntax, Parameters and the Return ValueExamples using popitem() methodExample 1 – Completely deleting all the elements from the dictionary using popitem()Example 2 – When the dictionary is empty or run out of elementsSuggested Reading Sometimes we need to iterate through a dictionary in Python and delete its items sequentially. To…
https://thecodingbot.com/python-dictionarys-popitem-method-with-examples/
Table of Contents Overviewpopitem() – Syntax, Parameters and the Return ValueExamples using popitem() methodExample 1 – Completely deleting all the elements from the dictionary using popitem()Example 2 – When the dictionary is empty or run out of elementsSuggested Reading Sometimes we need to iterate through a dictionary in Python and delete its items sequentially. To…
https://thecodingbot.com/python-dictionarys-popitem-method-with-examples/
The Coding Bot
Python dictionary's popitem() method with examples - The Coding Bot
In this article, we'll discuss python dictionary's built-in popitem() method with examples. It is used to remove elements from dictionary in LIFO order.
Python dictionary’s setdefault() method with examples
Table of Contents Overviewsetdefault() – Syntax, Parameters and the Return ValueExamples using setdefault() methodExample 1 – When the key is present in the dictionaryExample 2 – When the key isn’t present in the dictionary but a default value is passedExample 3 – When the key isn’t present and no default value is passed eitherReplicating setdefault()…
https://thecodingbot.com/python-dictionarys-setdefault-method-with-examples/
Table of Contents Overviewsetdefault() – Syntax, Parameters and the Return ValueExamples using setdefault() methodExample 1 – When the key is present in the dictionaryExample 2 – When the key isn’t present in the dictionary but a default value is passedExample 3 – When the key isn’t present and no default value is passed eitherReplicating setdefault()…
https://thecodingbot.com/python-dictionarys-setdefault-method-with-examples/
The Coding Bot
Python dictionary's setdefault() method with examples - The Coding Bot
In this tutorial, we'll see python dictionary's setdefault() method which is a combination of both get() and set() methods. We'll also see some illustrations.
A very detailed tutorial on autocompletion with Django and jQuery
Have you ever wondered how you type few in the search bar and it starts giving you suggestions? This feature has always been in my todo list and I finally implemented it a few days in my own website. This tutorial uses Jquery and Django for most of the part. So, yes, it’s a prerequisite. At least you should have a working knowledge.…
https://thecodingbot.com/a-very-detailed-tutorial-on-autocompletion-with-django-and-jquery/
Have you ever wondered how you type few in the search bar and it starts giving you suggestions? This feature has always been in my todo list and I finally implemented it a few days in my own website. This tutorial uses Jquery and Django for most of the part. So, yes, it’s a prerequisite. At least you should have a working knowledge.…
https://thecodingbot.com/a-very-detailed-tutorial-on-autocompletion-with-django-and-jquery/
The Coding Bot
A very detailed tutorial on autocompletion with Django and jQuery - The Coding Bot
In this tutorial, we will see how to implement autocomplete feature in django framework, we will also see how we can add onclick redirect functionality.
How to get Weekday name from Datetimefield in Django jinja2 templating
Overview Django uses a pretty powerful template engine known as Jinja. Not just for the Django, it has become a pretty famous template engine for overall Python. Instagram and Firefox are one of the many websites that use Jinja2. It is a treat for MVC/MVT based frameworks as it helps to differentiate frontend from the backend. Getting…
https://thecodingbot.com/how-to-get-weekday-name-from-datetimefield-in-django-jinja2-templating/
Overview Django uses a pretty powerful template engine known as Jinja. Not just for the Django, it has become a pretty famous template engine for overall Python. Instagram and Firefox are one of the many websites that use Jinja2. It is a treat for MVC/MVT based frameworks as it helps to differentiate frontend from the backend. Getting…
https://thecodingbot.com/how-to-get-weekday-name-from-datetimefield-in-django-jinja2-templating/
The Coding Bot
How to get Weekday name from Datetimefield in Django jinja2 templating - The Coding Bot
In this tutorial, we will see how we can get the weekday name from datetimefield in Django Jinja2 templating...
How do we filter rows of a pandas Dataframe by a column value
Overview Problem Statement: Given a Dataframe, filter the rows of the Dataframe by a column value. Solution: There exist at least 2 ways to fetch the rows based on a column value. Here’s what our the Dataframe looks like. The dataset was quite intact and had no NULLs. We are going to filter rows based on the Date column, with some manipulations. We will fetch all the…
https://thecodingbot.com/how-do-we-filter-rows-of-a-pandas-dataframe-by-a-column-value/
Overview Problem Statement: Given a Dataframe, filter the rows of the Dataframe by a column value. Solution: There exist at least 2 ways to fetch the rows based on a column value. Here’s what our the Dataframe looks like. The dataset was quite intact and had no NULLs. We are going to filter rows based on the Date column, with some manipulations. We will fetch all the…
https://thecodingbot.com/how-do-we-filter-rows-of-a-pandas-dataframe-by-a-column-value/
The Coding Bot
How do we filter rows of a pandas Dataframe by a column value - The Coding Bot
In this tutorial, we will see how we can filter a pandas dataframe rows based on a column value using different techniques...
Python’s list append() method with examples
Overview In this tutorial, we will see Python’s sequence type list’s append() method in great detail. We will see its syntax, the parameters it takes, the value it returns, and some examples demonstrating its usage. We will also dig into the runtime cost of the operation. list.append(x) list.append(x) appends a new object/item x to the…
https://thecodingbot.com/pythons-list-append-method-with-examples/
Overview In this tutorial, we will see Python’s sequence type list’s append() method in great detail. We will see its syntax, the parameters it takes, the value it returns, and some examples demonstrating its usage. We will also dig into the runtime cost of the operation. list.append(x) list.append(x) appends a new object/item x to the…
https://thecodingbot.com/pythons-list-append-method-with-examples/
The Coding Bot
Python's list append() method with examples - The Coding Bot
In this tutorial, we will discuss about python list's built-in append() method with some examples. We will also discuss about the time complexity of the method.
What is the difference between char a and char a[1] in C/C++?
Problem Statement In C/C++, what is the difference between the statements char a and char a[1]? Solution In the statement char a , a is a variable which is used to store a character datatype in the memory. While in the statement char a[1], a is an array of type char(character) of size 1, i.e…
https://thecodingbot.com/what-is-the-difference-between-char-a-and-char-a1-in-c-c/
Problem Statement In C/C++, what is the difference between the statements char a and char a[1]? Solution In the statement char a , a is a variable which is used to store a character datatype in the memory. While in the statement char a[1], a is an array of type char(character) of size 1, i.e…
https://thecodingbot.com/what-is-the-difference-between-char-a-and-char-a1-in-c-c/
The Coding Bot
What is the difference between char a and char a[1] in C/C++? - The Coding Bot
In this tutorial, we will see the difference between char a and char a[1] in C++. We will also see an example to concrete our understanding
Program to check if a given integer is an Armstrong number or not
Problem Statement Given a positive integer, you need to check if it is an Armstrong number or not. For example: Input: 143 1^3 + 4^3 + 3^3 = 74, which is not equal to 143. Output: No Input: 407 4^3 + 0^3 + 7^3 = 407, which is equal to 407. Output: Yes What is…
https://thecodingbot.com/program-to-check-if-a-given-integer-is-an-armstrong-number-or-not/
Problem Statement Given a positive integer, you need to check if it is an Armstrong number or not. For example: Input: 143 1^3 + 4^3 + 3^3 = 74, which is not equal to 143. Output: No Input: 407 4^3 + 0^3 + 7^3 = 407, which is equal to 407. Output: Yes What is…
https://thecodingbot.com/program-to-check-if-a-given-integer-is-an-armstrong-number-or-not/
The Coding Bot
Program to check if a given integer is an Armstrong number or not - The Coding Bot
In this tutorial, we will see if a number is armstrong number or not. We will discuss the time complexity of the algorithm along with some examples.
Python program to split a given list into Even and Odd list based on the parity of the numbers
Problem Statement Given a python list consisting of both even and odd integers, based on their parity separate them into even and odd list. For example: Input: list = [1,4,6,87] Output: even_list = [4,6] , odd_list = [1,87] The problem statement is pretty clear- we have a list of integers having both even and odd…
https://thecodingbot.com/python-program-to-split-a-given-list-into-even-and-odd-list-based-on-the-parity-of-the-numbers/
Problem Statement Given a python list consisting of both even and odd integers, based on their parity separate them into even and odd list. For example: Input: list = [1,4,6,87] Output: even_list = [4,6] , odd_list = [1,87] The problem statement is pretty clear- we have a list of integers having both even and odd…
https://thecodingbot.com/python-program-to-split-a-given-list-into-even-and-odd-list-based-on-the-parity-of-the-numbers/
The Coding Bot
Python program to split a given list into Even and Odd list based on the parity of the numbers - The Coding Bot
In this tutorial, we will see a python program to split a given list into two lists - Even and Odd based on the parity of the numbers.
Vim Introduction
This entry is part 1 of 1 in the series Complete Vim Tutorial Let’s start an amazing series of tutorials on our beloved editor – The Vim editor. Started off as a free, open-source software(editor) and enhancement of already existing Unix based editor – Vi, it has made a huge fanbase over the years. It…
https://thecodingbot.com/vim-introduction/
This entry is part 1 of 1 in the series Complete Vim Tutorial Let’s start an amazing series of tutorials on our beloved editor – The Vim editor. Started off as a free, open-source software(editor) and enhancement of already existing Unix based editor – Vi, it has made a huge fanbase over the years. It…
https://thecodingbot.com/vim-introduction/
The Coding Bot
Vim Introduction - The Coding Bot
Introduction - Vim is a free, opensource text editor, and an extremely powerful one at that. It was originally launched in the year 1991..
How to print a statement in C/C++ without a semicolon(;) – Different methods
Problem Statement: We need to print a statement, say “Hello World“, without using a semicolon in C/C++. Solution: To be honest, this isn’t a serious programming question, but, it is possible that you might face this question in an interview someday. It is a kind of puzzle problem. There are many different ways to achieve…
https://thecodingbot.com/how-to-print-a-statement-in-c-c-without-a-semicolon-different-methods/
Problem Statement: We need to print a statement, say “Hello World“, without using a semicolon in C/C++. Solution: To be honest, this isn’t a serious programming question, but, it is possible that you might face this question in an interview someday. It is a kind of puzzle problem. There are many different ways to achieve…
https://thecodingbot.com/how-to-print-a-statement-in-c-c-without-a-semicolon-different-methods/
The Coding Bot
How to print a statement in C/C++ without a semicolon(;) - Different methods - The Coding Bot
In this tutorial, we will learn different ways to print a statement, say Hello World, in c/c++ without using semicolon.
Print the Alphabet triangle in C++
Problem Statement Given the number of rows, write a program to print the Alphabet Triangle in C++. For example: Input: Rows = 5 Output: Alphabet triangle in C++ Solution Questions like this can be very easily solved, they just require our little attention. The most important step in solving these problems is to identify how…
https://thecodingbot.com/print-the-alphabet-triangle-in-c/
Problem Statement Given the number of rows, write a program to print the Alphabet Triangle in C++. For example: Input: Rows = 5 Output: Alphabet triangle in C++ Solution Questions like this can be very easily solved, they just require our little attention. The most important step in solving these problems is to identify how…
https://thecodingbot.com/print-the-alphabet-triangle-in-c/
The Coding Bot
Print the Alphabet triangle in C++ - The Coding Bot
In this tutorial, we will learn how to print the alphabet triangle in C++. We will discuss every step in great detail along with time complexity of the algorithm.
Different methods to swap two numbers in C++
Problem Statement Write a program to swap given two numbers in C++ For Example: Input: a = 10, b = 21 Output: a = 21, b = 10 Solution There are literally many solutions to this problem, some are pretty straightforward while some are not. In this article, you will learn at least 4 different…
https://thecodingbot.com/different-methods-to-swap-two-numbers-in-c/
Problem Statement Write a program to swap given two numbers in C++ For Example: Input: a = 10, b = 21 Output: a = 21, b = 10 Solution There are literally many solutions to this problem, some are pretty straightforward while some are not. In this article, you will learn at least 4 different…
https://thecodingbot.com/different-methods-to-swap-two-numbers-in-c/
The Coding Bot
Different methods to swap two numbers in C++ - The Coding Bot
In this tutorial, we will discuss different methods to swap two variables in c++. These approaches use addition, multiplication, subtraction and xor operators.
Print the Number triangle in C++
Problem Statement Given the number of rows(range), write a program to print the Number Triangle in C++. For Example: Input: 5 Output: Number triangle in C++ Solution Questions like this can be very easily solved, they just require our little attention. The most important step in solving these problems is to identify how the pattern…
https://thecodingbot.com/print-the-number-triangle-in-c/
Problem Statement Given the number of rows(range), write a program to print the Number Triangle in C++. For Example: Input: 5 Output: Number triangle in C++ Solution Questions like this can be very easily solved, they just require our little attention. The most important step in solving these problems is to identify how the pattern…
https://thecodingbot.com/print-the-number-triangle-in-c/
The Coding Bot
Print the Number triangle in C++ - The Coding Bot
In this tutorial, we'll see how we can print the number triangle in c++. We will also discuss the time and space complexity of the algorithm.
A very detailed tutorial on autocompletion with Django and jQuery
Have you ever wondered how you type few in the search bar and it starts giving you suggestions? This feature has always been in my todo list and I finally implemented it a few days in my own website. This tutorial uses Jquery and Django for most of the part. So, yes, it’s a prerequisite. At least you should have a working knowledge.…
https://thecodingbot.com/a-very-detailed-tutorial-on-autocompletion-with-django-and-jquery/
Have you ever wondered how you type few in the search bar and it starts giving you suggestions? This feature has always been in my todo list and I finally implemented it a few days in my own website. This tutorial uses Jquery and Django for most of the part. So, yes, it’s a prerequisite. At least you should have a working knowledge.…
https://thecodingbot.com/a-very-detailed-tutorial-on-autocompletion-with-django-and-jquery/
The Coding Bot
A very detailed tutorial on autocompletion with Django and jQuery - The Coding Bot
In this tutorial, we will see how to implement autocomplete feature in django framework, we will also see how we can add onclick redirect functionality.
Printing right-angled star triangle in C++
Problem Statement Given the number of rows, form a right-angled triangle made up of stars(asterisks) “*”. For Example: Input: 5 Output: Right-angled star triangle Solution You might have seen this problem when you were learning nested loops in Programming. When I started programming, I had a chapter on iterations and in that chapter, this problem…
https://thecodingbot.com/printing-right-angled-star-triangle-in-c/
Problem Statement Given the number of rows, form a right-angled triangle made up of stars(asterisks) “*”. For Example: Input: 5 Output: Right-angled star triangle Solution You might have seen this problem when you were learning nested loops in Programming. When I started programming, I had a chapter on iterations and in that chapter, this problem…
https://thecodingbot.com/printing-right-angled-star-triangle-in-c/
The Coding Bot
Printing right-angled star triangle in C++ - The Coding Bot
In this tutorial, we'll learn how to print right-angled star pattern in c++. We'll also discuss about the time and space complexity of the algorithm
Printing the mirror right-angled star triangle in C++
Problem Statement Given the number of rows, form a mirror right-angled triangle made up of stars(asterisks) “*”. For Example: Input: 5 Output: Mirror right-angled star triangle Solution This problem is pretty straightforward if you know how a nested loop works. Let’s understand this problem with an example. Consider the input number of rows = 5:…
https://thecodingbot.com/printing-the-mirror-right-angled-star-triangle-in-c/
Problem Statement Given the number of rows, form a mirror right-angled triangle made up of stars(asterisks) “*”. For Example: Input: 5 Output: Mirror right-angled star triangle Solution This problem is pretty straightforward if you know how a nested loop works. Let’s understand this problem with an example. Consider the input number of rows = 5:…
https://thecodingbot.com/printing-the-mirror-right-angled-star-triangle-in-c/
The Coding Bot
Printing the mirror right-angled star triangle in C++ - The Coding Bot
In this tutorial, we'll see how we can print a mirror right-angled triangle in C++. We will also see the time and space complexity of the algorithm..
Printing complete star triangle in C++
Problem Statement Given the number of rows, form a complete triangle made up of stars(asterisks) “*”. For Example Input: 5 Output: Complete star triangle pattern in C++ Solution This is an easy problem which can be solved simply using nested loops. Let’s try to understand this problem with an example. Consider the input number of rows…
https://thecodingbot.com/printing-complete-star-triangle-in-c/
Problem Statement Given the number of rows, form a complete triangle made up of stars(asterisks) “*”. For Example Input: 5 Output: Complete star triangle pattern in C++ Solution This is an easy problem which can be solved simply using nested loops. Let’s try to understand this problem with an example. Consider the input number of rows…
https://thecodingbot.com/printing-complete-star-triangle-in-c/
The Coding Bot
Printing complete star triangle in C++ - The Coding Bot
In this tutorial, we'll learn how to print complete star triangle pattern in C++. We'll also discuss the time and space complexity of the algorithm.
Print inverted half star triangle pattern in C++
Problem Statement Given the number of rows, form an inverted half triangle pattern made up of stars(asterisks) “*”. For Example Input: 5 Output: Inverted half star triangle pattern in C++ Solution This is an easy problem which can be solved simply using nested loops. Let’s try to understand this problem with an example. Consider the input number…
https://thecodingbot.com/print-inverted-half-star-triangle-pattern-in-c/
Problem Statement Given the number of rows, form an inverted half triangle pattern made up of stars(asterisks) “*”. For Example Input: 5 Output: Inverted half star triangle pattern in C++ Solution This is an easy problem which can be solved simply using nested loops. Let’s try to understand this problem with an example. Consider the input number…
https://thecodingbot.com/print-inverted-half-star-triangle-pattern-in-c/
The Coding Bot
Print inverted half star triangle pattern in C++ - The Coding Bot
In this tutorial, we will learn how to make a inverted half triangle star pattern in C++. We'll also discuss the time and space complexity of the algorithm.
Print a hollow star triangle in C++
Problem Statement Given the number of rows, form a hollow triangle pattern made up of stars(asterisks) “*”. For Example Input: 5 Output: Hollow star pattern in C++ Solution This problem is a little tricky in comparison to its sister problems(printing complete triangle). However, with just a little modification, this problem can also be easily solved. The…
https://thecodingbot.com/print-a-hollow-star-triangle-in-c/
Problem Statement Given the number of rows, form a hollow triangle pattern made up of stars(asterisks) “*”. For Example Input: 5 Output: Hollow star pattern in C++ Solution This problem is a little tricky in comparison to its sister problems(printing complete triangle). However, with just a little modification, this problem can also be easily solved. The…
https://thecodingbot.com/print-a-hollow-star-triangle-in-c/
The Coding Bot
Print a hollow star triangle in C++ - The Coding Bot
Table of Contents Problem StatementSolutionSteps in detailImplementation of the above approachTime and Space complexity analysis Problem Statement Given the number of rows, form a hollow triangle pattern made up of stars(asterisks) “*”. For Example Input:…