Pradeep Elance has Published 498 Articles

degrees() and radians() in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 12:08:06

444 Views

The measurements of angles in mathematics are done using these two units of measurement called degree and radian. They are frequently used in math calculations involving angles and need conversion from one value to another. In python we can achieve these conversions using python functions.degrees() FunctionThis function takes radian value ... Read More

Counting the frequencies in a list using dictionary in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:53:22

1K+ Views

In this article we develop a program to calculate the frequency of each element present in a list.Using a dictionaryHere we capture the items as the keys of a dictionary and their frequencies as the values.Example Live Demolist = ['a', 'b', 'a', 'c', 'd', 'c', 'c'] frequency = {} for item ... Read More

chr () in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:42:08

463 Views

This function return the string representing a character whose Unicode code point is the integer supplied as parameter to this function. For example, chr(65) returns the string 'A', while chr(126) returns the string '~'.SyntaxThe syntax of the function is as below.chr(n) where n is an integer valueExampleThe below program shows ... Read More

Change data type of given numpy array

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:35:13

364 Views

The Numpy array support a great variety of data types in addition to python's native data types. After an array is created, we can still modify the data type of the elements in the array, depending on our need. The two methods used for this purpose are array.dtype and array.astypearray.dtypeThis ... Read More

Change Data Type for one or more columns in Pandas Dataframe

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:30:14

1K+ Views

Many times we may need to convert the data types of one or more columns in a pandas data frame to accommodate certain needs of calculations. There are some in-built functions or methods available in pandas which can achieve this.Using astype()The astype() method we can impose a new data type ... Read More

Calendar in python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:23:06

263 Views

The calendar module in python has features to handle all the features related to calendar and dates. It is one of the very extensively used module which has many in-built functions to use dates in the python programs.Example Live Demoimport calendar print(calendar.calendar(2019))OutputRunning the above code gives us the following result −  ... Read More

Calendar Functions in Python | Set 1( calendar(), month(), isleap()…)

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 11:00:37

141 Views

Handling date through some type of in-built calendar is central to any programming language. Here we see how to handle various date related functions available in python’s in-built library.firstweekday()Using this function we find the number assigned to the first day of the week.Example Live Demoimport calendar # print starting day ... Read More

Calculate n + nn + nnn + ? + n(m times) in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 10:47:57

270 Views

There are a variety of mathematical series which python can handle gracefully. One such series is a series of repeated digits. Here we take a digit and add it to the next number which has two such digits and again the next number is three such digits and so on. ... Read More

Basic calculator program using Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 10:43:32

790 Views

In this program we will see how to accomplish the basic calculator functionalities of a calculator using a python program. Here we create individual functions to carry out the calculations and return the result. Also user input is accepted along with the choice of operator.Example# This function performs additiion def ... Read More

Analysis of Different Methods to find Prime Number in Python

Pradeep Elance

Pradeep Elance

Updated on 23-Aug-2019 09:11:32

127 Views

A prime number is a a positive integer which is divisible only by 1 or itself. Finding whether a number is prime or not is an interesting programming challenge for long time. Moreover there are different menthods and they have different efficiency. In this article we will look at three ... Read More

Advertisements