
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sarika Singh has Published 118 Articles

Sarika Singh
2K+ Views
SyntaxError in Python occurs when the interpreter encounters invalid syntax, such as missing colons, unmatched parentheses, incorrect indentation, or invalid keywords. Since this error happens during the code compilation stage (before execution), it cannot be caught using a regular try-except block. To handle it, you must wrap the faulty code ... Read More

Sarika Singh
8K+ Views
In Python, an IOError (or OSError in latest versions) occurs when an input/output operation fails. For example, when we are trying to read a file that doesn’t exist, writing to a file that is read-only, or accessing a corrupted device. You can catch IOError using a try-except block to handle ... Read More

Sarika Singh
591 Views
In Python, you can check whether a substring exists within another string using Python in operator, or string methods like find(), index(), and __contains__(). A string in Python is a sequence of characters that is enclosed in quotes. You can use either single quotes '...' or double quotes "..." to ... Read More

Sarika Singh
162 Views
In Python, exception names usually end with "Error" (like ZeroDivisionError, NameError, and TypeError). This clearly shows that they are related to problems that happen while the program is running. Using this naming style makes error messages easier to read, helps with debugging. Why exceptions end with "Error" An exception is ... Read More

Sarika Singh
2K+ Views
To pass a variable to an exception in Python, provide the variable as an argument when raising the exception. For custom exceptions, store the variable in an attribute. You can pass variables like strings or numbers directly into built-in exceptions to include dynamic data in the error message. Example: Passing ... Read More

Sarika Singh
95K+ Views
Python has a built-in method called values() that returns a view object. The dictionary values are listed in the view object. We can use the values() method in Python to retrieve all values from a dictionary. Python's built-in values() method returns a view object that represents a list of dictionaries ... Read More

Sarika Singh
1K+ Views
In Python, the try, except, and else statements are used to handle exceptions and define specific blocks of code that should execute based on whether an error occurs or not. This helps you manage errors and separate successful code from error-handling logic. Using "try" and "except" The try block contains ... Read More

Sarika Singh
3K+ Views
Using "except" Clause with Multiple Exceptions It is possible to define multiple exceptions with the same except clause. It means that if the Python interpreter finds a matching exception, then it will execute the code written under the except clause. Syntax In general, the syntax for multiple exceptions is as follows - ... Read More

Sarika Singh
393 Views
In Python, instead of writing separate except blocks for each exception, you can handle multiple exceptions together in a single except block by specifying them as a tuple. In this example, we are catching both ValueError and TypeError using a single except block - try: x = ... Read More

Sarika Singh
668 Views
RuntimeErrors in Python are a type of built-in exception that occurs during the execution of a program. They usually indicate a problem that arises during runtime and is not necessarily syntax-related or caused by external factors.When an error is detected, and that error doesn't fall into any other specific category ... Read More