Using Counter in Python 3.x to Find Minimum Character Removal for Anagrams

Pavitra
Updated on 29-Aug-2019 07:45:40

246 Views

In this article, we will learn about how we can make a string into a pangram using the counter() function in Python 3.x. Or earlier. To do so we are allowed to remove any character from the input string. We will also find the number of such required characters to be removed to make the string into an anagram.Two strings are said to be anagrams of each other when they contain the same type of alphabets in any random order.The counter () method is present in the collection module available in Python. The prerequisite is to import the collections module ... Read More

Understanding Code Reuse and Modularity in Python 3

Pavitra
Updated on 29-Aug-2019 06:51:29

866 Views

Introduction to Object-Oriented Programming(OOP)?OOP refers to Object-Oriented Paradigm and is referred to as the heart of programming methodology. It includes several concepts like polymorphism, encapsulation, data hiding, data abstraction, inheritance & modularity.OOP gives data the prime consideration and by providing an interface through the functions associated with it. An object is a self-sufficient entity i.e. it has all the variables and associated functions with it. Objects have characteristics(variables) and features(methods), known as attributes.What is Modularity?Modularity refers to the act of partitioning the code into modules building them first followed by linking and finally combining them to form a complete project. ... Read More

Processing Time with Pandas DataFrame

Pavitra
Updated on 29-Aug-2019 06:44:37

243 Views

In this article, we will learn about generating & processing different timestamps using built-in pandas library. We are also using the numpy module to generate and modify the database needed for the timestamp generation.Preferable IDE: Jupyter notebookBefore beginning this tutorial we must install pandas and numpy library. For this jupyter notebook is the best place to test and run your code. For installing pandas we must run the following command.>>> pip install pandasIf we run this command all the dependencies are automatically installed. After it’s done we must restart the kernel to see the changes.After we finished installing all the ... Read More

First-Class Citizens in Python

Pavitra
Updated on 29-Aug-2019 06:37:15

3K+ Views

First-class citizens are entities that enable support for all the operations facilitating other fellow entities.These entities are often used : while passing an argument , returning a value from function , conditional modifications & value assignment.In this article, we will look at the implementation & usage of first-class citizens in Python 3.x or earlier. Also, we will be learning what all entities get the tag of being First Class citizens.These citizens include Variables along with functions.Let’s first get familiar with the data types that are part of First-class citizensIntegersFloating typeComplex NumbersStringsAll four types mentioned above are given the tag of ... Read More

Learning Model Building in Scikit-Learn

Pavitra
Updated on 29-Aug-2019 06:20:30

323 Views

In this article, we will learn about the Learning Model Building in Scikit-learn: A Python Machine Learning Library.It is a free machine learning library. It supports various algorithm like the random forest, vector machines & k-nearest neighbours with direct implementation with numpy and scipy.Importing the datasetimport pandas Url = < specify your URL here> data=pandas.rad_csv(url)Data exploration and cleaningWe can use the head method to specify/filter the records according to our needs.data.head() data.head(n=4) # restricting the record to be 4We can also implement the last few records of the datasetdata.tail() data.tail(n=4) # restricting the record to be 4Now comes the stage ... Read More

Keyboard Module in Python

Pavitra
Updated on 28-Aug-2019 14:06:59

2K+ Views

In this article, we will learn about the use of the Keyboard module in Python 3.x. Or earlier.Ide preferred − Jupyter notebookInstallation −>>> pip install keyboardFunctionalities of the module −Allows us to block the action of specific keysWe can manage intents from the keyboard using on click listeners.Cross-platform compatibility.Supports special & hotkeys available on the keyboard.Now let’s implement this in the form of code −Exampleimport keyboard # It writes the content keyboard.write("Tutorialspoint") # It writes end of line keyboard.press_and_release('shift + o, shift + y, ') keyboard.press_and_release('k, j') # it blocks until ctrl keyboard.wait('Ctrl')OutputTutorialspoint O Y k jExampleimport keyboard # It ... Read More

Is the Future with Snake Python or Coffee Java?

Pavitra
Updated on 28-Aug-2019 14:04:53

207 Views

In this article, we will learn about the scope of python and java in implementing the upcoming and trending technologies with ease.JavaFeatures of javaIt is object-orientedIt’s is platform-independentInvolves distributed computing and network capabilitiesMultithreading is supportedSecurity is prioritizedThe stack allocation system is availableSupported/ Available frameworksSpring framework( web applications)Grails ( dynamic environment)Java server facesGoogle web toolkitPlay frameworkStruts frameworkPythonFeatures of pythonInterpreted Object-Oriented languageModular, Dynamic and robust in naturePortableCross-platform compatibilityExtensible in C/C++Extensive library and third part dependencies supportSupported/ Available frameworksDjango framework( web-based application)Flask ( webserver)Tornado ( Web sockets )Sanic framework ( multi-level handling)Giotto framework( full stack development)Bottle framework ( Rest API’s)ConclusionIn this article, we ... Read More

What is the Python Global Interpreter Lock (GIL)?

Pavitra
Updated on 28-Aug-2019 13:52:08

423 Views

In this article, we will learn about What is the Python Global Interpreter Lock (GIL).This is a lock or hindrance that resistant the availability of the Python interpreter to multiple threads simultaneously. GIL is identified as a fault/issue in Python 3.x. Or earlier as it doesn’t allow multithreading in a multi-threaded architecture.Why is it introduced?Python supports the concept of automatic garbage collection. As soon as the reference count of an object reaches zero the memory is cleaned and free for usage.>>> import sys >>> var = {} >>> print(sys.getrefcount(ar)) >>> 2 >>> v=var >>> print(sys.getrefcount(v)) >>> 3Of in this case ... Read More

Vectorization in Python

Pavitra
Updated on 28-Aug-2019 13:47:51

1K+ Views

In this article, we will learn about vectorization and various techniques involved in implementation using Python 3.x. Or earlier.What is Vectorization?Vectorization is a technique to implement arrays without the use of loops. Using a function instead can help in minimizing the running time and execution time of code efficiently. Various operations are being performed over vector instead of arrays such as dot product of vectors which is also known as scalar product as it produces single output, outer products which results in square matrix of dimension equal to (length X length) of the vectors, Element wise multiplication which products the ... Read More

Accessibility in React JS

Shyam Hande
Updated on 28-Aug-2019 09:12:18

462 Views

The aria-* attributes on html elements are also supported in React.js as well. The other attributes are generally written in camel-case but these aria-* are written in hyphen-cased.Sometimes we break the semantics of the html if we use parent div in React.jsExamplerender(){    return(                Test          ); }Div can cause semantics issue if working with table, list etc. To avoid this we can use React provided fragment as shown below −import React, { Fragment } from ‘react’; function MessageList({ message }) {    return (       ... Read More

Advertisements