Python control flow – For loop and range function – with example
Python control flow – For loop and range function Loops are an important part of Python and other programming languages. Besides being able to iterate over iterables, they can also…
Python control flow – For loop and range function Loops are an important part of Python and other programming languages. Besides being able to iterate over iterables, they can also…
Python control flow – The while loop and the break statement The while loop in Python and other programming languages enables us to execute a group statement multiple times as…
The Python printing method and how to take in user input In this article, we will explore how to print objects to the terminal and how to take in user…
Python if-elif-else statements Conditional statements like Python if-elif-else are an essential part of decision-making in any programming language. In Python, conditional statements allow us to evaluate various conditions and execute…
Python Logical Operators Logical operators are used to performing various logical operations in programming. Python logical operators also allow you to check various conditions using multiple conditional operators. There are…
What are the Python comparison operators used for? Comparison operators also known as relational operators are used to comparing values of two operands. Depending on the condition being tested, comparison…
HTML How to change fonts - sample code The font-family property defines which font to display for a given HTML element. <h1 style="font-family:verdana;">This is a heading</h1> <p style="font-family:courier;">And this is…
Python absolute value – basics An absolute value of a number describes the distance from zero that a number is on the number line. It can also be defined as…
Python concatenate strings – basics Strings in Python are an array of bytes representing Unicode characters. In Python, strings are surrounded by double or single quotation marks. Unlike other programming…
What is Python threading used for? A thread is a set of operations that are set for execution by a computer. Threading speeds up the process of program execution by…
What is the Python queue data structure used for? Python queue is a linear abstract data structure that follows the first in-first out (FIFO) approach. This means that the first…
What is the Python argparse module? The argparse module is one of the many Python modules that are used to pass arguments to a python script when running Python programs…
What is a Python decorator? Python decorators allow us to change the behaviour of a function without permanently making changes to the syntax of that function. This simply means that…
How does the Python compiler work? Python is an interpreted language which means that at runtime code is converted into low-level bytecode before being executed by the virtual machine. This…
How to stop a program in Python Exiting a program is the process of terminating an active python program from executing further statements. Normally program execution implicitly comes to an…
How to throw an exception in Python An exception is an unusual or unexpected occurrence within a program that interrupts the normal flow of the program. There are quite a…
How to add to dictionary in Python A dictionary is an ordered collection of items stored in key/value pairs. To create a dictionary simply enclose a pair of items in…
How to remove items from a list in Python? Lists are some of the commonly used among the four built-in data types in Python. Lists are created using square brackets…
How to print on the same line in Python? Python’s print function is perhaps the most used function in Python. The print function helps us display things on the standard…
How to convert strings to integers or floats without getting an error message? In this article, we will learn how to convert strings to integers and backwards. Now, this is…
How to reverse a string in Python and when to use it Strings are immutable objects in Python, which means that even if we wanted to reverse them in place,…
How to use classes in Python? Python is an object-oriented programming language. Therefore, unlike procedure-oriented languages, python makes heavy use of classes and objects. A class in Python is often…
How to use Python pip? What is it good for? Pip – the Package Installer for Python – is a package manager that is used to install and manage software…
How to import a library in Python? In Python, libraries are used to refer to a collection of modules that are used repeatedly in various programs without the need of…
How to end a program in Python There are quite a number of reasons why a programmer may want a program to stop running at some point. Some of the…
How to create threads in Python A thread is a set of operations that are set for execution by a computer. Threading speeds up program execution by allowing us to…
How to debug in Python using PDB Debugging is a very important aspect of writing programs that every developer should master. The built-in module PDB is an interactive source code…
How to ask for user input in Python? User input is an important part of any program regardless of the technology used. Programs often require input from the users in…