Exceptions and errors are undesirable events in any program which may lead to termination of the program execution prematurely. In python,We use … [Read more...] about Why try-except error handling is useful in Python
When to Use try/catch Instead of if/else
While programming, we have to deal with many constraints which are imposed on variables so that program can be executed in proper way. To enforce the … [Read more...] about When to Use try/catch Instead of if/else
How to Comment Inside a Python Dictionary
Comments in python are very handy in increasing the readability and maintainability of code. Generally we use comments to describe functions and class … [Read more...] about How to Comment Inside a Python Dictionary
How to create multiline comments in Python
Comments are used to enhance readability and understandability of source code by providing proper information about the code. Comments are not … [Read more...] about How to create multiline comments in Python
Comment out a block of code in Python
There may be many situations while testing or debugging python programs where we want a certain statement in the code or a block of statements in the … [Read more...] about Comment out a block of code in Python
User Defined Exceptions in Python
When we write programs in python for real life applications, there are many constraints on the values which the variables can take in the program. For … [Read more...] about User Defined Exceptions in Python
How to remove punctuation from a Python String
Often during data analysis tasks, we come across text data which needs to be processed so that useful information can be derived from the data. During … [Read more...] about How to remove punctuation from a Python String
How to split string variables in Python
There may be many situations where we may need to split string variables. To split string variables in python we can use split() method, rsplit() … [Read more...] about How to split string variables in Python
String Splicing in Python
Python strings are sequences of characters enclosed in single, double or triple quotes. Strings are immutable in python. We can access each character … [Read more...] about String Splicing in Python
What is a good comment/code ratio?
A comment is a piece of code that isn’t executed by the compiler or interpreter when the program is executed. Comments can only be read when we have … [Read more...] about What is a good comment/code ratio?