Afiz ⚑️
Afiz ⚑️

@itsafiz

8 Tweets 4 reads Sep 26, 2022
Common Errors in Python (with code snippets)
In this thread, we see some of the common Python programming errors, what they mean and how to fix them.
A Thread πŸ§΅πŸ‘‡
1️⃣ NameError in Python
A NameError indicates that the name of the variable is referenced, which has not been defined.
2️⃣ TypeError
TypeError occurs when the object's data type is not appropriate for the operation.
For Example:
1. Multiplication of two strings.
2. Performing a round operation on a string
3️⃣ ValueError
ValueError occurs when the function can’t handle the input value.
Example:
β†’ Passing a string to a function that expects a number as input
4️⃣ ModuleNotFoundError
ModuleNotFoundError occurs when we are trying to import a module that doesn't exist.
⚑️ Reasons:
1. Typo in your import system
2. Incorrect virtualenv or incorrect installation path
3. Not installed the module
5️⃣ ZeroDivisionError
ZeroDivisionError occurs when we are trying to divide by zero.
Lastly, I would like to thank @BowTied_Raptor. With help of his blog, I cloud stitch this thread. Check out his blog, if you are getting starting Data Science and Machine Learning. πŸ‘‡
bowtiedraptor.substack.com
Thanks for reading!
I hope you like this content.
1. Follow me @itsafiz for more such content.
2. RT and Like the first tweet πŸ‘‡
See you again with another great content. Till then Take care πŸŽ‰

Loading suggestions...