Explore your training options in 10 minutes

X

Back

Global navigation

Learn Python

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.

Python SyntaxError: ‘return’ outside function Solution
A return statement sends a value from a function to a main program. If you specify a return statement outside of a function, you’ll encounter the “SyntaxError: ‘return’ outside function” error. In this guide, we explore what the “‘return’ outside…
Python SyntaxError: ‘break’ outside loop Solution
A break statement instructs Python to exit a loop. If you use a break statement outside of a loop, for instance, in an if statement without a parent loop, you’ll encounter the “SyntaxError: ‘break’ outside loop” error in your code.…
Python Web Development: Not Just for Newbies
So many things we’ve come to enjoy in recent years are thanks to programming. From the video games to the apps we browse on our phones, and even the websites we visit, a great deal of them are made possible…
Python TypeError: ‘list’ object cannot be interpreted as an integer Solution
Many built-in functions, like range(), expect integer values as an input. If you try to use a list as an input to a function that expects an integer, you’ll encounter the “TypeError: ‘list’ object cannot be interpreted as an integer”…
Python Tuples: A Step-By-Step Guide
Python tuples are a data structure that store an ordered sequence of values. Tuples are immutable. This means you cannot change the values in a tuple. Tuples are defined with parenthesis. Tuples are a core data structure in Python. They…
Python maximum recursion depth exceeded in comparison Solution
Recursive functions, without limits, could call themselves indefinitely. If you write a recursive function that executes over a certain number of iterations, you’ll encounter the “maximum recursion depth exceeded in comparison” Python error. This guide discusses what this error means…
Python Boolean: A Complete Guide
The Python Boolean data type has only two possible states, the keywords False and True. Booleans cannot hold any other value, and are the smallest data type. Booleans are essential to many aspects of programming, like the use of if…
What Is Python Used For? The Many Uses of Python Programming
What is Python used for? Python is a general-purpose programming language, so it can be used for many things. Python is used for web development, AI, machine learning, operating systems, mobile application development, and video games. A successor to the…
Python TypeError: list indices must be integers or slices, not float Solution
Lists are indexed using index numbers. These numbers are integer values. If you try to access an item from a list using a floating-point number, the “TypeError: list indices must be integers or slices, not float” error will be raised.…
Python TypeError: slice indices must be integers or None or have an __index__ method Solution
Lists are indexed using whole numbers. Whole numbers are known integers. If you try to slice a list using a value that is not an integer, you’ll encounter the “TypeError: slice indices must be integers or None or have an…
Python TypeError: ‘str’ object cannot be interpreted as an integer Solution
The range() method only accepts integer values as a parameter. If you try to use the range() method with a string value, you’ll encounter the “TypeError: ‘str’ object cannot be interpreted as an integer” error. This guide discusses why you…
Python TypeError: object of type ‘int’ has no len() Solution
Only iterable objects such as strings and lists have a length. If you try to calculate the length of a number, you’ll encounter the “TypeError: object of type ‘int’ has no len()” error. In this guide, we discuss what this…
Python ValueError: not enough values to unpack Solution
Unpacking syntax lets you separate the values from iterable objects. If you try to unpack more values than the total that exist in an iterable object, you’ll encounter the “ValueError: not enough values to unpack” error. This guide discusses what…
Python Hello World: A How-To Guide
The Python "Hello World" program is usually the first program a coder will write in Python. This program uses a print statement to display a string to the Python console. The program looks like: print("Hello World"). One of the very…
Python TypeError: cannot use a string pattern on a bytes-like object Solution
You must provide a string to the re library if you want to manipulate an object using a string pattern. If you try to use a string pattern on an object which is stored using the “bytes” data type, you’ll…
Python TypeError: builtin_function_or_method is not iterable Solution
When you call a built-in function, you must specify curly brackets after the name of the function. If you try to iterate over a built-in method or function without curly brackets, you’ll encounter the “TypeError: builtin_function_or_method is not iterable” error.…
Python: How to Print a Dictionary
Dictionaries store data in key-value pairs. This means each value in a dictionary is associated with a key. This key acts as a reference point. If you want to view the contents of a dictionary on the console, there are…
Remove the First n Characters from a String in Python
The slicing syntax lets you remove a particular character or range of characters from a string based on the index values of those characters. This guide discusses how to remove the first n characters from a string in Python. It…
Python AttributeError: ‘module’ object has no attribute ‘urlopen’ Solution
The urllib module changed the way that the request function is accessed in Python 3. This means that if you try to reference the “urlopen” function in the way that you do in Python 2, you’ll encounter the “AttributeError: ‘module’…
Python SyntaxError: Missing parentheses in call to ‘print’ Solution
In Python 3, you must enclose all print statements with parenthesis. If you try to print out a string to the console without enclosing the string in parenthesis, you’ll encounter the “SyntaxError: Missing parentheses in call to ‘print’” error. This…
Python SyntaxError: can’t assign to literal Solution
Variables cannot be assigned to literal values like strings or numbers. If you try to assign a variable to a literal, you’ll encounter the “SyntaxError: can’t assign to literal” error. This guide discusses what this error means and why you…
Python TypeError: ‘type’ object is not subscriptable Solution
“type” is a special keyword in Python that denotes a value whose type is a data type. If you try to access a value from an object whose data type is “type”, you’ll encounter the “TypeError: ‘type’ object is not…
Python: Retrieve the Index of the Max Value in a List
Through indexing, you can retrieve an item or range of items from a list. You can only retrieve a specific item from a list if you know the index number associated with that value. To find the index value of…
Python: Pad Zeros
Some numbers need to begin with a zero or multiple zeros. For instance, a user ID may need to have a certain number of zeros at the start if it is under a certain number so all ID numbers are…
Python TypeError: unhashable type: ‘slice’ Solution
Values in a Python dictionary cannot be sliced like a list. This is because dictionaries can have custom key values. They are not indexed from zero. If you try to slice a dictionary as if it were a list, you’ll…
Python TypeError: unsupported operand type(s) for +: ‘nonetype’ and ‘str’ Solution
Strings can be concatenated in Python. This lets you merge the value of two or more strings into one string. If you try to concatenate a string and a value equal to None, you’ll encounter the “TypeError: unsupported operand type(s)…
Python: Remove Last Character from String
Strings are iterable objects. This means you can access their values using indexing and slicing. These techniques allow you to retrieve an individual character or range of characters from a string. In this guide, we discuss how to remove the…
Python Switch Statement: A How-to Guide
Unlike Java or C#, Python does not have a built-in switch statement. This means you cannot evaluate a switch expression without having to write your own code that mimics a “switch...case” statement. In this guide, we discuss how to write…
Python TabError: inconsistent use of tabs and spaces in indentation Solution
You can indent code using either spaces or tabs in a Python program. If you try to use a combination of both in the same block of code, you’ll encounter the “TabError: inconsistent use of tabs and spaces in indentation”…
Python TypeError: cannot unpack non-iterable NoneType object Solution
Python sequences can be unpacked. This means you can assign the contents of a sequence to multiple variables. If you try to unpack a None value using this syntax, you’ll encounter the “TypeError: cannot unpack non-iterable NoneType object” error. In…
Ad
At Career Karma, our mission is to empower users to make confident decisions by providing a trustworthy and free directory of bootcamps and career resources. We believe in transparency and want to ensure that our users are aware of how we generate revenue to support our platform.

Career Karma recieves compensation from our bootcamp partners who are thoroughly vetted before being featured on our website. This commission is reinvested into growing the community to provide coaching at zero cost to their members.

It is important to note that our partnership agreements have no influence on our reviews, recommendations, or the rankings of the programs and services we feature. We remain committed to delivering objective and unbiased information to our users.

In our bootcamp directory, reviews are purely user-generated, based on the experiences and feedback shared by individuals who have attended the bootcamps. We believe that user-generated reviews offer valuable insights and diverse perspectives, helping our users make informed decisions about their educational and career journeys.
Find the right bootcamp for you
X
GET MATCHED
By completing and submitting this form, you agree that Career Karma, LLC may deliver or cause to be delivered information, advertisements, and telemarketing messages regarding their services by email, call, text, recording, and message using a telephone system, dialer, automated technology or system, artificial or prerecorded voice or message device to your email and/or telephone number(s) (and not any other person’s email or telephone number) that you entered. Consent is not a condition of receiving information, receiving Career Karma services, or using the website, and you may obtain information by emailing info@careerkarma.com. Message & Data rates may apply. Message frequency may vary. Text STOP to unsubscribe. Terms of Service and Privacy Policy govern the processing and handling of your data.
X
By completing and submitting this form, you agree that Career Karma, LLC may deliver or cause to be delivered information, advertisements, and telemarketing messages regarding their services by email, call, text, recording, and message using a telephone system, dialer, automated technology or system, artificial or prerecorded voice or message device to your email and/or telephone number(s) (and not any other person’s email or telephone number) that you entered. Consent is not a condition of receiving information, receiving Career Karma services, or using the website, and you may obtain information by emailing info@careerkarma.com. Message & Data rates may apply. Message frequency may vary. Text STOP to unsubscribe. Terms of Service and Privacy Policy govern the processing and handling of your data.