Coding

How do you count repeated words in a list in Python?

How do you count repeated words in a list in Python?

In this post, we will talk about how to count repeated words in python list. It can be done in many ways. Using collections.Counter() # Importing counter function. from collections import Counter words = ["a", "b", "a", "c", "c", "a", "c"] duplicate_dict = Counter(words) print(duplicate_dict)#to get occurence of each of the element. print(duplicate_dict['a'])# to get occurence of specific element. Output: Counter({'a': 3, 'c': 3, 'b': 1}) 3 Using count() letter = ["b", "a", "a", "c", "b", "a", "c",'a'] counting=letter.count('a') print(counting) Output: > 4 Hope this helps! Important Notice for college students If you’re a college student and have skills in programming languages,…
Read More
What is the difference between artificial and convolutional neural networks?

What is the difference between artificial and convolutional neural networks?

A Convolutional Neural Network (ConvNet/CNN) is a Deep Learning algorithm that can take in an input image, assign importance (learnable weights and biases) to various aspects/objects in the image, and be able to differentiate one from the other. The pre-processing required in a ConvNet is much lower as compared to other classification algorithms. While in primitive methods filters are hand-engineered, with enough training, ConvNets have the ability to learn these filters/characteristics. The architecture of a ConvNet is analogous to that of the connectivity pattern of Neurons in the Human Brain and was inspired by the organization of the Visual Cortex. Individual neurons…
Read More
What is the VGG 19 neural network?

What is the VGG 19 neural network?

VGG 19 is a convolutional neural network architecture that is 19 layers deep. The main purpose for which the VGG net was designed was to win the ILSVRC imagenet competition. Let’s take a brief look at the architecture of VGG19. Input: The VGG-19 takes in an image input size of 224×224.Convolutional Layers: VGG’s convolutional layers leverage a minimal receptive field, i.e., 3×3, the smallest possible size that still captures up/down and left/right. This is followed by a ReLU activation function. ReLU stands for rectified linear unit activation function, it is a piecewise linear function that will output the input if positive otherwise, the output is zero. Stride is…
Read More
How do I solve tough programming problems in HackerRank?

How do I solve tough programming problems in HackerRank?

If you are a beginner then go with easy problems first, try to solve as much you can for getting confidence. If, you are not able to solve easy problems then spend some time on that try to think harder, even you can't solve the problem go for editorial read the approach, don't read the code and try to solve your own spend time and practice gives you high return for sure. If you think you can solve easy problems go for a medium one. Go with the same approach as you have done with easy problems…even giving more time…
Read More
What is the difference between the append() and insert() list methods in Python?

What is the difference between the append() and insert() list methods in Python?

Difference between append() and insert () Append(): This function is used to modify an already existing list. Adds a new specific element at the end of the list. Syntax: List_Name.append(item) Insert(): This function also modifies an already existing list. The only difference between append() and insert() is that the insert function allows us to add a specific element at a specified index of the list unlike append() where we can add the element only at end of the list. Syntax: List_Name.insert(index, item) Refer below example for better understanding Important Notice for college students If you’re a college student and have…
Read More
Create a digital clock using Python-Turtle

Create a digital clock using Python-Turtle

Prerequisites: Turtle in programming Python. Turtle is a special feature of Python. Using Turtle, we can easily draw on a drawing board. First, we import the turtle module. Then create a window, next we create a turtle object and using the turtle methods we can draw on the drawing board. In this blog we'll be creating a digital clock using turtle and python. Installation:  To install this module type the below command in the terminal. pip install turtle Note: To create a clock we will use the ‘time’ and ‘DateTime’ module of Python also, To install time use the following command:…
Read More
Python Dictionary

Python Dictionary

Dictionary (Dict)  in Python is an unordered collection of data values, used to store data values like a map, which, unlike other Data Types that hold only a single value as an element, Dictionary holds the key: value pair. Key-value is provided in the dictionary to make it more optimized.  Note – Keys in a dictionary don’t allow Polymorphism. Disclamer: It is important to note that Dictionaries have been modified to maintain insertion order with the release of Python 3.7, so they are now ordered collection of data values. Creating a Dictionary In Python, a Dictionary can be created by placing a sequence of…
Read More
How to create a voice recorder in Python

How to create a voice recorder in Python

Python can be used to perform a variety of tasks. One of them is creating a voice recorder. We can use python’s sounddevice module to record and play audio. This module along with the wavio or the scipy module provides the way to save recorded audio. Installation sounddevice: This module provides functions to play and record NumPy arrays containing audio signals. Let’s install it by running the following command: $ pip3 install sounddevice We can use either wavio and scipy to save the recorded audio in file format. We will see both of them here.To install wavio: $ pip3 install wavio To install scipy: $ pip3 install scipy Now, we are done with installing the…
Read More
Stationarity Analysis in Time Series Data

Stationarity Analysis in Time Series Data

Hey Geeks !!! in this blog, we'll dive into the concept of stationarity using time series data. We'll first understand what is time-series data, what is stationarity, why and when data should be stationary etc...We'll use the dataset I created specifically for this blog to analyze whether the data is stationary or not. We'll also see how to convert the non-stationary data to stationary. Index IntroductionImport Libraries and DependenciesDefine TimeSeriesData ClassImport DatasetAccumulating Number of Sales by monthCreate objectStationarity TestsGraphical TestRolling-Statistics TestAugmented Dickey-Fuller Test (ADF)Kwiatkowski-Phillips-Schmidt-Shin Test (KPSS)Zivot-Andrews TestConclusionConvert data to StationaryDerivativesTransformation using Logarithmic FunctionADF TestKPSS TestZivot-Andrews TestRolling-Statistics TestConclusion 1. Introduction 1.1…
Read More