How to Create an Empty List in Python?

To create an empty list in Python, you can use two ways. First, the empty square bracket notation [] creates a new list object without any element in it. Second, the list() initializer method without an argument creates an empty list object too. Both approaches are shown in the following code: Next, you’ll learn many … Read more

The Book of Dash [Reviews]

On this page, I collect reviews from readers of The Book of Dash (NoStarch, 2022): Thanks for all your ❀️! “Perfect for any student of Data Science” “Just the book I’ve been looking for. This is the perfect next step for any Python student seeking to pivot into the Data Science niche. Easy to follow, … Read more

CSV to XML – How to Convert in Python?

Problem Formulation Input: You have some data in a CSV file stored in ‘my_file.csv’ where the first row is the header and the remaining rows are values associated to the column names in the header. Name,Job,Age,Income Alice,Programmer,23,110000 Bob,Executive,34,90000 Carl,Sales,45,50000 Desired Output: You want to store the data in an XML file ‘my_file.xml’ so that each … Read more

np.argsort() — A Simpe Illustrated Guide

In Python, the numpy.argsort() function returns the indices that would sort an array in ascending order.  Here is the argument table of the numpy.argsort() function. If it sounds great to you, please continue reading, and you will fully understand the numpy.argsort() function through Python code snippets and vivid visualization. This tutorial is about numpy.argsort() function.  … Read more

How to Skip a Line in Python using \n?

Summary: Python’s newline character \n indicates the end of a line of text. The built-in print() function automatically adds a newline character \n at the end. You can customize this behavior of separating two lines using a single newline character ‘\n’ by changing the default end=’\n’ argument of the print() function to your desired string. … Read more

Ten Best Python 3 Online Compilers [Visual List]

Do you want to run your Python 3 script online? These are the 10 best Python compilers online: #1 – Repl.it Online Python 3 Compiler 🌍 Link: https://repl.it/languages/python3 #2 – Programiz Online Python 3 Compiler 🌍 Link: https://www.programiz.com/python-programming/online-compiler/ #3 – OnlineGDB Python 3 Compiler 🌍 Link: https://www.onlinegdb.com/online_python_compiler #4 – Online-Python.com Compiler 🌍 Link: https://www.online-python.com/ #5 … Read more

How to Extend a Dictionary in Python

Problem Formulation and Solution Overview In this article, you’ll learn how to extend a Dictionary in Python. To make it more fun, we have the following running scenario: Weddings-911, an Event Planner start-up, has just booked three (3) new clients and is hoping for many more! This data is saved to the Dictionary weddings. Beth, … Read more