Computer Programming
440 subscribers
6 files
231 links
We mainly post about Tech Interview Prep, Machine Learning, Full Stack, Data Structures, Algorithms & Programming Languages.

Please check the pinned message and invite your friends to this channel. Sharing is Caring 💕
Download Telegram
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
IPython/Jupyter notebook keyboard shortcuts

Overview 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 and data science industry. Definition from the documentation, The notebooks documents are documents produced by the Jupyter…

https://thecodingbot.com/ipython-jupyter-notebook-keyboard-shortcuts/
Markdown in Jupyter/Ipython notebook cheatsheet

Overview It makes a huge difference if you present your data science work with clean code, amazing graphs and Markdowns(WoW) !!! We often get so indulge in getting things done that we forget about the representation. Markdowns in Jupyter notebooks beautify them and also improves the readability of the code. Remember to add graphs and…

https://thecodingbot.com/markdown-in-jupyter-ipython-notebook-cheatsheet/
Reading CSV file in Numpy

Overview Pandas provide a nice way to read the content of a CSV file into a dataframe using its pandas.read_csv() function, however, there is a need sometimes to read the content of a CSV file into numpy arrays. In this tutorial, we will try to cover every method which can be used to read the…

https://thecodingbot.com/reading-csv-file-in-numpy/
Convert a Python list to a Pandas Dataframe

Overview Problem Statement: Given a Python list, convert it into a Pandas Dataframe Before anything, the first thing we need to decide is, how many rows and columns we want to have in our dataframe. A list of 12 elements can be converted into a dataframe of: 3 columns with 4 rows, 6 columns with…

https://thecodingbot.com/convert-a-python-list-to-a-pandas-dataframe/