Vikram Chiluka has Published 288 Articles

How to sort the objects in a list in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 03-Nov-2023 02:44:41

2K+ Views

In Python, a list is an ordered sequence that can hold several object types such as integer, character, or float. In other programming languages, a list is equivalent to an array. Square brackets are used to denote it, and a comma (, ) is used to divide two items in ... Read More

How does * operator work on list in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 03-Nov-2023 02:38:15

12K+ Views

In Python, a list is an ordered sequence that can hold several object types such as integer, character, or float. In other programming languages, a list is equivalent to an array Repetition Operator(*) A repetition operator is supported by sequence datatypes (both mutable and immutable). * The repetition operator * ... Read More

How does in operator work on list in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 03-Nov-2023 02:33:54

16K+ Views

In Python, a list is an ordered sequence that can hold several object types such as integer, character, or float. In other programming languages, a list is equivalent to an array. Square brackets are used to denote it, and a comma (, ) is used to divide two things in ... Read More

How to get a list of all the values from a Python dictionary?

Vikram Chiluka

Vikram Chiluka

Updated on 02-Nov-2023 21:29:31

12K+ Views

In this article, we'll show you how to use several ways to extract a list of all the values from a Python dictionary. Using the following methods, we may obtain a list of all the values from a Python dictionary − Using dict.values() & list() functions Using [] and ... Read More

How to perform arithmetic operations on a date in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 02-Nov-2023 02:03:02

7K+ Views

In this article, we will show you how to perform arithmetic operations on a date in Python. Now we see 5 examples for this task− Adding days to a given Date Subtracting days to a given Date Adding Days and Hours to the given date Subtracting months from a ... Read More

How to set the first day of each week to weekday using Python?

Vikram Chiluka

Vikram Chiluka

Updated on 02-Nov-2023 01:55:00

3K+ Views

In this article, we will show you how to set the first day of each week to a weekday using Python. Now we see 2 methods to accomplish this task− Using setfirstweekday() function Using setfirstweekday() function to set a given weekday Number Method 1: Using setfirstweekday() function to ... Read More

How to sort a Python date string list?

Vikram Chiluka

Vikram Chiluka

Updated on 02-Nov-2023 01:52:09

29K+ Views

In this article, we will show you how to sort a Python date string list. Now we see 3 methods to accomplish this task− Now we see 2 methods to accomplish this task− Using sort() and lambda functions Using sort() function Using sorted function Method 1: Using sort() ... Read More

How to get a value for a given key from a Python dictionary?

Vikram Chiluka

Vikram Chiluka

Updated on 31-Oct-2023 03:14:37

25K+ Views

In this article, we will show you how to get a value for the given key from a dictionary in Python. Below are the 4 different methods to accomplish this task − Using dictionary indexing Using dict.get() method Using keys() Function Using items() Function Assume we have taken ... Read More

How do you round up a float number in Python?

Vikram Chiluka

Vikram Chiluka

Updated on 26-Oct-2023 03:44:45

21K+ Views

In this article, we will show you how to round up a float number in Python. Round up float number using the round() function The round() function gives a floating point number with a specified number of decimals which is the rounded version of the specified number. The function will ... Read More

How to find only Monday's date with Python?

Vikram Chiluka

Vikram Chiluka

Updated on 28-Sep-2023 01:59:51

7K+ Views

In this article, we will show you how to find only Monday's date using Python. We find the last Monday, next Monday, nth Monday's dates using different methods− Using timedelta() function Using relativedelta() function to get Last Monday Using relativedelta() function to get next Monday Using relativedelta() function to ... Read More

1 2 3 4 5 ... 29 Next
Advertisements