Python is a popular programming language used to develop websites, analyze data, and automate tasks. These various Python articles provide information on courses, resources, books, and communities to help you learn this coding language. There is also a handy glossary of Python terminology, quizzes and exercises, and specific resources for various career paths.
Learn Python
Python TypeError: ‘module’ object is not callable Solution
Python modules are confusing, especially when you define your own. “TypeError: ‘module’ object is not callable” is one of the most common mistakes that Python developers make when working with classes. In this guide, we talk about what this error…
Python typeerror: not all arguments converted during string formatting
Python is a stickler for the rules. One of the main features of the Python language keeps you in check so that your programs work in the way that you intend. You may encounter an error saying “not all arguments…
The Python Yield Keyword: A Guide
How to Use the Python Yield Keyword Generators aren’t the most intuitive concept in Python. To make matters worse, they use a special keyword called “yield,” even though generators are themselves functions. What is the yield keyword? How does it…
Python positional argument follows keyword argument Solution
In Python, there are two types of arguments: positional and keyword arguments. These arguments must appear in a particular order otherwise the Python interpreter returns an error. In this guide, we’re going to talk about the “positional argument follows keyword…
Remove Punctuation Python: A Guide
How to Remove Punctuation from a Python String There are a lot of cases where you may need to remove punctuation from a string. You may want to remove any punctuation from a string number that a user inserts into…
Python indexerror: list assignment index out of range Solution
An IndexError is nothing to worry about. It’s an error that is raised when you try to access an index that is outside of the size of a list. How do you solve this issue? Where can it be raised?…
Python typeerror: ‘int’ object is not subscriptable Solution
Some objects in Python are subscriptable. This means that they contain, or can contain, other objects. Integers are not a subscriptable object. They are used to store whole numbers. If you treat an integer like a subscriptable object, an error…
Python indexerror: list index out of range Solution
IndexErrors are one of the most common types of runtime errors in Python. They’re raised when you try to access an index value inside a Python list that does not exist. In most cases, index errors are easy to resolve.…
Python nameerror name is not defined Solution
NameErrors are one of the most common types of Python errors. When you’re first getting started, these errors can seem intimidating. They’re not too complicated. A NameError means that you’ve tried to use a variable that does not yet exist.…
Python syntaxerror: EOL while scanning string literal Solution
Even the best developers make syntax errors all the time when they’re coding. Programming languages have so many rules and even one typo can cause an error. If you’ve encountered the error “syntaxerror: EOL while scanning string literal”, don’t worry.…
Python typeerror: string indices must be integers Solution
In Python, iterable objects are indexed using numbers. When you try to access an iterable object using a string value, an error will be returned. This error will look something like “TypeError: string indices must be integers”. In this guide,…
Python typeerror: can’t multiply sequence by non-int of type ‘float’ Solution
While strings can be multiplied by integers to create a repeating sequence, strings cannot be multiplied by floats. Otherwise, Python returns an error. In this article, we’re going to talk about the “typeerror: can t multiply sequence by non-int of…
Python typeerror: a bytes-like object is required, not ‘str’ Solution
TypeErrors happen all of the time in Python. This type of error is raised when you try to apply a function to a value that does not support that function. For example, trying to iterate over a number raises a…
Python typeerror: ‘int’ object is not iterable Solution
Encountering an error is not a problem; it’s a learning opportunity. While developing in Python, you may have seen an error “‘int’ object is not iterable”. What does this mean? How do I solve it? Those are the questions we’re…
Python typeerror: list indices must be integers or slices, not str Solution
String indices must be integers or slices, not strings? What does this error mean? It’s a TypeError, which tells us that we are trying to perform an operation on a value whose type is not compatible with the operation. What’s…
Python typeerror: can only concatenate str (not “int”) to str Solution
You’ve just started writing a Python program and then it hits you: a TypeError. This one’s new to you: "typeerror: can only concatenate str (not "int") to str". What does it mean? Why is it being raised in your code?…
Python ‘str’ object does not support item assignment solution
Strings in Python are immutable. This means that they cannot be changed. If you try to change the contents of an existing string, you're liable to find an error that says something like "'str' object does not support item assignment".…
How to Sort a Dictionary by Value in Python
To sort a dictionary by value in Python you can use the sorted() function. Python’s sorted() function can be used to sort dictionaries by key, which allows for a custom sorting method. sorted() takes three arguments: object, key, and reverse.…
How to Code the Fibonacci Sequence in Python
The Fibonacci Sequence is one of the most famous sequences in mathematics. It’s quite simple to calculate: each number in the sequence is the sum of the previous two numbers. This sequence has found its way into programming. Often, it…
How to Use Python Environment Variables
When you’re developing across different environments, you may want to specify different configuration values for each environment. The computer on which you developed an application will not be the same as the one on which you deploy an application. That’s…
Python Factorial: A Guide
How to Calculate a Python Factorial You may remember the word “factorial” from your high school math class. They’re not very easy to calculate without a calculator. Who wants to calculate the factorial of 10 by manually multiplying 1x2x3x4 and…
NumPy Concatenate: A Guide
How to Concatenate NumPy Arrays NumPy is an excellent library for working with arrays in Python. It covers everything from creating to manipulating arrays of all sizes. It’s no surprise then that NumPy comes with a utility that you can…
Python Recursion: A Guide
How to Use Python Recursion Python recursion is an intimidating topic for beginners. Let’s dispel the myth that recursion is difficult by defining it. Recursion is a method of programming where a function calls itself. That sounds simple, right? When…
Python Assert Statements: A Step-By-Step Guide
The Python assert keyword tests if a condition is true. If a condition is false, the program will stop with an optional message. Assert statements are used to debug code and handle errors. You should not use an assert statement…
Python Float: A Step-By-Step Guide
The Python float() method converts a number stored in a string or integer into a floating point number, or a number with a decimal point. Python floats are useful for any function that requires precision, like scientific notation. Programming languages…
Python Print Without Newline: Step-by-Step Guide
To print without a new line in Python 3 add an extra argument to your print function telling the program that you don't want your next string to be on a new line. Here's an example: print("Hello there!", end =…
Python Compare Strings: A Step-By-Step Guide
Strings in Python are compared with == and != operators. These compare if two Python strings are equivalent or not equivalent, respectively. They return True or False. Often, when you’re working with strings in Python, you may want to compare…
Python String to Int() and Int to String Tutorial: Type Conversion in Python
How to Convert Python String to Int:To convert a string to integer in Python, use the int() function. This function takes two parameters: the initial string and the optional base to represent the data. Use the syntax print(int("STR")) to return…
How to Write a Python Generator
Iterators play an important role in Python. They allow you to create an object that can be iterated upon. It’s a good way to store data that can be accessed through a for in loop. The trouble with iterators is…
A 2020 Guide to Python 2 vs Python 3
Python 3 is more in-demand and includes a typing system. Python 2 is outdated and uses an older syntax for the print function. While Python 2 is still in use for configuration management in DevOps, Python 3 is the current…