Vikram Chiluka has Published 286 Articles

How can I generate random integers between 0 and 9 using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 11:23:17

3K+ Views

In this article, we will show you how to generate random integers between 0 and 9 in Python. Below are the various methods to accomplish this task: Using randint() method Using randrange() method Using secrets module To generate random integers within certain ranges, Python supports a variety of ... Read More

How can I convert bytes to a Python string?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Oct-2022 08:28:47

11K+ Views

In this article, we will show you how to convert bytes to a string in python. Below are the various methods to accomplish this task − Using decode() function Using str() function Using codecs.decode() function Using pandas library Using decode() function The built-in decode() method in python, is ... Read More

How can I append a tuple into another tuple in Python?

Vikram Chiluka

Vikram Chiluka

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

9K+ Views

In this article, we will show you how to append a tuple into another in python. Below are the various methods to accomplish this task − Using + operator. Using sum() function. Using list() & extend() functions. Using the unpacking(*) operator. Tuples are an immutable, unordered data type ... Read More

How to Transpose a matrix in Single line in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 13:12:50

2K+ Views

In this article, we will show you how to transpose a matrix in a single line in python. Below are the various ways to accomplish this task − Using Nested List Comprehension Using NumPy Module Using zip() Function What is the transpose of the matrix? A matrix transpose ... Read More

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

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 13:08:03

8K+ Views

In this article, we will show you how to randomly select an item from a string 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 pick a random number not in a list in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 12:44:48

2K+ Views

In this article, we will show you how to pick a random number not in a list in python. Below are the various methods to accomplish this task − Using random.choice() function Using random.choice() function and List Comprehension Using random.choice() & set() functions Using random.randrange() function Using random.choice() ... Read More

How to Convert Decimal to Binary Using Recursion in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 12:37:31

2K+ Views

In this article, we will show you how to convert decimal to binary using recursion in python. A decimal number is the most familiar number system to the general public. It is base 10 which has only 10 symbols − 0, 1, 2, 3, 4, 5, 6, 7, 8, and ... Read More

How to Check if a Number is Odd or Even using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 12:36:20

4K+ Views

In this article, we will show you how to check if a number is odd or even in python. Below are the methods to accomplish this task − Using modulo (%) operator Using Recursion Using the Binary AND (&) operator Using modulo (%) operator Python's modulo (%) operator ... Read More

How to calculate square root of a number in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 12:24:16

2K+ Views

In this article, we will show you how to calculate the square root of a number in Python. Below are the various methods to accomplish this task − Calculating square root using sqrt() Calculating the square root using the pow() function Calculating the square root using the exponent operator ... Read More

How can I remove the same element in the list by Python

Vikram Chiluka

Vikram Chiluka

Updated on 27-Oct-2022 12:12:50

2K+ Views

In this article, we will show you how to remove the same element in the list in python. In simple words removing common elements from both lists. Below are the various methods to accomplish this task − Using remove() function Using List Comprehension Using Set difference operator Using Set ... Read More

Advertisements