Python Interview Questions – Set 05

How to create a Unicode string in Python? In Python 3, the old Unicode type has replaced by “str” type, and the string is treated as Unicode by default. We can make a string in Unicode by using art.title.encode(“utf-8”) function.

Python Interview Questions – Set 04

How to overload constructors or methods in Python? Python’s constructor: _init__ () is the first method of a class. Whenever we try to instantiate an object __init__() is automatically invoked by python to initialize members of an object. We can’t overload constructors or methods in Python. It shows an error if we try to overload. … Read more

Python Interview Questions – Set 03

How can you organize your code to make it easier to change the base class? You have to define an alias for the base class, assign the real base class to it before your class definition, and use the alias throughout your class. You can also use this method if you want to decide dynamically … Read more

Python Interview Questions – Set 02

What is Pass in Python? Pass specifies a Python statement without operations. It is a placeholder in a compound statement. If we want to create an empty class or functions, this pass keyword helps to pass the control without error. # For Example class Student: pass # Passing class class Student: def info(): pass # Passing function How can you … Read more

Python Interview Questions – Set 01

Give the output of this example: A[3] if A=[1,4,6,7,9,66,4,94]. Since indexing starts from zero, an element present at 3rd index is 7. So, the output is 7. What is PEP 8? PEP 8 is defined as a document that helps us to provide the guidelines on how to write the Python code. It was written … Read more

Python Interview Questions

Python Interview Questions – Set 05 Python Interview Questions – Set 04 Python Interview Questions – Set 03 Python Interview Questions – Set 02 Python Interview Questions – Set 01