Vikram Chiluka has Published 286 Articles

Examples of runtime errors in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 31-Oct-2022 12:03:56

9K+ Views

In this article, we will look at some examples of runtime errors in Python Programming Language Runtime Errors A runtime error in a program is one that occurs after the program has been successfully compiled. The Python interpreter will run a program if it is syntactically correct (free of ... Read More

How to select elements from Numpy array in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 31-Oct-2022 11:38:25

17K+ Views

In this article, we will show you how to select elements from a NumPy array in python. Numpy Array in Python A NumPy array is a central data structure of the NumPy library, as the name implies. The name of the library is an abbreviation for "Numeric Python" or "Numerical ... Read More

How to invert a matrix or nArray in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 31-Oct-2022 11:25:00

19K+ Views

In this article, we will show you how to calculate the inverse of a matrix or ndArray using NumPy library in python. What is inverse of a matrix? The inverse of a matrix is such that if it is multiplied by the original matrix, it results in an identity matrix. ... Read More

How to Flatten a Matrix using numpy in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 31-Oct-2022 11:21:45

3K+ Views

In this article, we will show you how to flatten a matrix using the NumPy library in python. numpy.ndarray.flatten() function The numpy module includes a function called numpy.ndarray.flatten() that returns a one-dimensional copy of the array rather than a two-dimensional or multi-dimensional array. In simple words, we can say that ... Read More

How to shuffle a list of objects in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:42:21

8K+ Views

In this article, we will show you how to shuffle a list of objects in python. Below are the various methods to accomplish this task: Using random.shuffle() function Using random.sample() function Using Fisher–Yates shuffle Algorithm Using random.randint() and pop() function Assume we have taken a list containing ... Read More

How to randomly select an item from a tuple in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:37:12

4K+ Views

In this article, we will show you how to randomly select an item from a tuple using python. Below are the various methods in python to accomplish this task: Using random.choice() method Using random.randrange() method Using random.randint() method Using random.random() Using random.sample() method Using random.choices() method Assume ... Read More

How to find power of a number in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:33:35

13K+ Views

In this article, we will show you how to find the power of a number in python. Below are the various methods to accomplish this task − Using for loop Using Recursion Using pow() function Using ** operator Using for loop Algorithm (Steps) Following are the Algorithm/steps to ... Read More

How to Find HCF or GCD using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:31:48

1K+ Views

In this article, we will show you how to find the HCF (Highest Common Factor) or GCD (Greatest Common Factor) in Python. Below are the various methods to accomplish this task: Using For Loop Using Euclidean Algorithm Using While Loop Using Recursion(Naive method) Handling Negative Numbers in HCF What is ... Read More

How to do Python math at command line?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:29:37

1K+ Views

In this article, we will show you how to do python math at the command line. Python is an interpreter-based language. When you invoke the Python interpreter, (>>>) Python prompt appears. Any Python statement can be entered in front of it. As soon as you press ENTER, the statement ... Read More

How can I represent python tuple in JSON format?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:24:45

21K+ Views

In this article, we will show you how to represent a tuple in python in JSON format. We will see the below-mentioned methods in this article: Converting Python Tuple to JSON Converting Python Tuple with Different Datatypes to JSON String Parsing JSON string and accessing elements using json.loads() method. ... Read More

Advertisements