Python

Python: 3 Ways to Select Random Elements from a List

Updated: June 6, 2023 By: Khue

This succinct and practical article shows you a couple of different ways to randomly select one or multiple elements from a given list in Python. Without any further…

Working with statistics.fmean() function in Python

Updated: February 7, 2023 By: Goodman

In statistics, mean (also known as average) is a central tendency measurement of a set of values. Mean is calculated by adding up all the values in a…

Python: Generate a Random Float between Min and Max (3 ways)

Updated: June 3, 2023 By: Khue

This practical article shows you 3 different ways to generate a random floating point number in a given range between a min value and a max value. All…

Python: Get the Current Date and Time with Timezone

Updated: January 17, 2023 By: Wolf

In Python, you can get the current date and time in a particular time zone by using the datetime.now() method (recommended) or the datetime.fromtimestamp() method and specify the…

Ways to Combine Lists in Python

Updated: June 6, 2023 By: Frienzied Flame

This succinct and practical article walks you through a couple of different ways to combine multiple lists in Python. Each approach will be accompanied by a clear illustrative…

Python: How to Convert Date Strings into Date Objects

Updated: January 16, 2023 By: Frienzied Flame

In Python, you can convert a date string (a string representing a date) into a date object by using the datetime.strptime() method. Syntax: Where: Examples This example turns…

How to Compare 2 Dates in Python

Updated: January 16, 2023 By: Frienzied Flame

There might be cases where you have to compare 2 dates to determine which one is earlier and which one is later. In Python, you can compare 2…

How to Check Python versions on Mac

Updated: January 15, 2023 By: Goodman

If your macOS version is lower than 12.3, then Python 2 is pre-installed on your computer, and you can see it version by running the command below: Note:…

Python: Generate a Random Integer between Min and Max

Updated: June 3, 2023 By: Khue

To generate a random integer between two given integers, the quickest and most convenient way is to use the randint() function from the random module. The minimum and…

Extract all links from a webpage using Python and Beautiful Soup

Updated: January 15, 2023 By: Goodman

This article shows you how to get all links from a webpage using Python 3, the requests module, and the Beautiful Soup 4 module. For the demonstration purpose,…

1 61 62 63 64