Python Articles - Page 906 of 1048

Python Program for Find the perimeter of a cylinder

Pavitra
Updated on 11-Sep-2019 11:45:20

137 Views

In this article, we will learn about the solution to the problem statement given below −Problem statement − Input diameter and height, find the perimeter of a cylinderPerimeter is nothing but the side view of a cylinder i.e. a rectangleTherefore Perimeter= 2 * ( h + d )here d is the diameter of the cylinderh is the height of the cylinderNow let’s see the implementationExample Live Demo# Function to calculate the perimeter of a cylinder def perimeter( diameter, height ) :    return 2 * ( diameter + height ) # main diameter = 5 ; height = 10 ; print ... Read More

Windows 10 Toast Notifications with Python

Pavitra
Updated on 30-Aug-2019 12:55:21

1K+ Views

We can create a notifier for the events that occurred in Windows using Python. This is very simple with the win10toast module. If you are familiar with the Toast in Android then understanding the Toast notifications with Python is a piece of cake. We can generate notifications whenever an event occurs as a remainder. Let's see.Run the following command in command-line to install win10toast modulepip install win10toastIf the module successfully installed then, you will get the following result when you run the command.Collecting win10toast Downloading https://files.pythonhosted.org/packages/d4/ba/95c0ea87d9bcad68b90d8cb130a313b939c88d8338a2fed7c11eaee972fe/win10toast-0.9-py2.py3-none-any.whl Collecting pypiwin32 (from win10toast) Downloading https://files.pythonhosted.org/packages/d0/1b/2f292bbd742e369a100c91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-none-any.whl Requirement already satisfied: setuptools in c:\users\hafeezulkareem\anaconda3\lib\site-packages (from win10toast) ... Read More

What are the tools to support Data Science other than Python and R?

Pavitra
Updated on 29-Aug-2019 12:21:47

146 Views

In this article, we will learn about the tools to support Data Science other than Python and R?Here we will look at five tools that help in implementing the concept of data science.Apache HadoopJava-based free softwareLarge storage capabilityThe splitting capacity of dataNosqlMore structured orientationBetter performance efficiencyOpen-source software efficiencyHiveDistributed data management systemHighly useful in data miningTorchScientific computing frameworkIt uses Lua programming languageIt can easily implement deep learning algorithmsDomino data labUnified data science toolIncreases iteration speedRemoves deployment frictionConclusionIn this article, we learned about some of the powerful tools available in the field of data science other than Python & R.

Looping Techniques in Python

Pavitra
Updated on 29-Aug-2019 12:09:14

266 Views

In this tutorial, we will learn about looping techniques in python 3.x. Or earlier. There are many ways in which we can implement loops. Here we will be discussing four techniques in looping.Enumeration constructExample Live Demo# enumerate() type for index, value in enumerate(['Tutorial', 'point']):    print(index, value)Output0 Tutorial 1 pointZip constructExample Live Demo# zip() method arr1 = ['Tutorial', 'point'] arr2 = ['python', 'loops'] for i, j in zip(arr1, arr2):    print(i, j)OutputTutorial python point loopsMembership constructExample Live Demo# membership operator for i in ['Tutorial', 'point']:    print(i)OutputTutorial pointInfinitive constructExample# infinite loop while(True):    passStep - based constructExample# range with step incrementer For i ... Read More

K’th Non-repeating Character in Python using List Comprehension and OrderedDict

Pavitra
Updated on 29-Aug-2019 12:01:21

363 Views

In this article, we will learn about K’th Non-repeating Character in Python using List Comprehension and OrderedDict. To do so we take the help of inbuilt constructs available in Python.Algorithm1. First, we form a dictionary data from the input. 2. Now we count the frequency of each character. 3. Now we extract the list of all keys whose value equals 1. 4. Finally, we return k-1 character.Examplefrom collections import OrderedDict import itertools def kthRepeating(inp, k):    # returns a dictionary data    dict=OrderedDict.fromkeys(inp, 0)       # frequency of each character    for ch in inp:       ... Read More

Iterator Functions in Python

Pavitra
Updated on 29-Aug-2019 11:56:38

377 Views

In this article, we will learn about the four iterator functions available in Python 3.x. Or earlier namely accumulate() , chain(), filter false() , dropwhile() methods.Now let’s look on each of them in detail −Accumulate () & chain() methodAccumulate() method takes two arguments, one being iterable to operate on and another the function/operation to be performed. By default, the second argument performs the addition operation.Chain() method prints all the iterable targets after concatenating all of the iterables.The below example explains the implementation −Example Live Demoimport itertools import operator as op # initializing list 1 li1 = ['t', 'u', 't', 'o', 'r'] ... Read More

Introduction-to-convolutions-using-python

Pavitra
Updated on 29-Aug-2019 11:47:42

296 Views

In this article, we will learn about convolutions in Python 3.x. Or earlier. This articles come under neural networks and feature extraction.Ide preferred − Jupyter notebookPrerequisites − Numpy installed, Matplotlib installedInstallation>>> pip install numpy >>>pip install matplotlibConvolutionConvolution is a type of operation that can be performed on an image to extract the features from it by applying a smaller container called a kernel/coordinate container like a sliding window over the image. Depending on the values in the convolutional coordinate container, we can pick up specific patterns/features from the image.Here, we will learn about the detection of horizontal and vertical endpoints in ... Read More

Internal working of Set in Python

Pavitra
Updated on 29-Aug-2019 11:43:38

450 Views

In this article, we will learn about the Internal working of Set in Python. We will observe the union and intersection operation in different frames and objects.Let’s declare an empty set.>>> s=set()Now let’s declare a set with elements.>>> s1=set('tutorialspoint')Adding an element into an empty set.>>> s.add(‘p’)Now we declare another set with the name of Python.>>> s2=set('python')Now let’s see the union operation.>>> s3=s1.union(s2)Finally, we implement the intersection option.>>> s4=s1.intersection(s2)ConclusionIn this article, we learned about the Internal working of Set in Python 3.x. Or earlierRead More

Internal working of Python

Pavitra
Updated on 29-Aug-2019 11:38:09

2K+ Views

In this article, we will learn about the internal working of python & how different objects are allocated space in the memory by the python interpreter.Python is an object-oriented programming construct language like Java. Python uses an interpreter and hence called an interpreted language. Python supports minimalism and modularity to increase readability and minimize time and space complexity. The standard implementation of python is called “cpython” and we can use c codes to get output in python.Python converts the source code into a series of byte codes. So within python, compilation stage happens, but directly into byte code and this ... Read More

Internal working of the list in Python

Pavitra
Updated on 29-Aug-2019 11:34:57

349 Views

In this tutorial, we will learn about the internal working of the list in Python 3.x. Or earlier. We will also look at the object and frame formation when we write a python statement at each step.Initializing the list: This means that we are creating a list with some elements.>>> lis=[1, 2, 3, 4]Here list variable is declared in the global frame which is referring to a list object as shown aboveNow let’s see what happened when we append the element in the list.>>> lis.append(8)Here the element is added at the end and the size of the list is increased ... Read More

Advertisements