AmitDiwan has Published 11365 Articles

Python program to convert float decimal to octal number

AmitDiwan

AmitDiwan

Updated on 12-Aug-2022 11:57:33

483 Views

Octal Number uses eight digits, 0, 1, 2, 3, 4, 5, 6, 7. Also called as base 8 number system. Each position in an octal number represents a 0 power of the base (8). Last position in an octal number represents a x power of the base (8). Decimal number ... Read More

Python program to convert floating to binary

AmitDiwan

AmitDiwan

Updated on 12-Aug-2022 11:54:31

3K+ Views

In this article, we will see how to convert floating-point value to binary. Binary uses two digits, 0 and 1. Also called as base 2 number system Each position in a binary number represents a 0 power of the base (2). Last position in a binary number represents a x ... Read More

Break a list into chunks of size N in Python

AmitDiwan

AmitDiwan

Updated on 12-Aug-2022 11:53:11

427 Views

In this example, we will learn how to break a list into chunks of size N. We will be using the list() function here. The list() function creates a list object. A list object is a collection which is ordered and changeable. Break a list into chunks of size N ... Read More

Python program to find common elements in three lists using sets

AmitDiwan

AmitDiwan

Updated on 12-Aug-2022 11:44:01

1K+ Views

In this article, we will learn how to find common elements in three lists. The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list ... Read More

Python program to find N largest elements from a list

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 12:41:41

1K+ Views

In this example, we will see how to find the N largest elements from a List. The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in ... Read More

How to write an empty function in Python?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 12:05:44

2K+ Views

In this article, we will see how we can create an empty functions in Python. A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. Function blocks begin ... Read More

Python program to Find the first non-repeating character from a stream of characters?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:57:47

7K+ Views

In this article, we will find the first non-repeating character from a stream of character. Let’s say the following is our input − Thisisit The following should be our output displaying first non-repeating character − H Find the first non-repeating character from a stream of characters using while ... Read More

Swap two variables in one line in using Python?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:50:04

2K+ Views

We will learn how to swap two variables in one line. Let’s say the following is our input − a = 10 b = 5 The following is our output after swap − a = 5 b = 10 Swap two variables in one line using comma operator ... Read More

How to check if a string is a valid keyword in Python?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:45:16

2K+ Views

To check if a string is a valid keyword, import the keyword module and use the iskeyword() method. With that, you can directly display all the keywords at once and verify. Let’s say the following is our input − else The following is the output. The “else” is a ... Read More

Python program to print duplicates from a list of integers?

AmitDiwan

AmitDiwan

Updated on 11-Aug-2022 11:41:43

2K+ Views

We will display duplicates from a list of integers in this article. The list is can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type Let’s say we ... Read More

Advertisements