Disclaimer: This document is for reading only and I do not own the copyright to the content in this article.
What is python?
Python is a high-level and object-oriented programming language with unified semantics designed primarily for developing apps and the web. It is the core language in the field of RAD as it offers options such as dynamic building and dynamic typing.
What type of language is Python? Programming or Scripting?
Python is suitable for scripting, but in general, it is considered a general-purpose programming language.
What are the two major loop statements?
for and while
What do you understand by the term PEP 8?
PEP 8 is the Python latest coding convention and it is abbreviated as Python Enhancement Proposal. It is all about how to format your Python code for maximum readability.
Define modules in Python?
The module is defined as a file that includes a set of various functions and Python statements that we want to add to our application.
What are Python Decorators?
Decorator is the most useful tool in Python as it allows programmers to alter the changes in the behaviour of class or function.
How do we find bugs and statistical problems in Python?
We can detect bugs in python source code using a static analysis tool named PyChecker. Moreover, there is another tool called PyLint that checks whether the Python modules meet their coding standards or not.
What is the difference between and .py and .pyc files?
py files are Python source files and .pyc files are the compiled bytecode files that are generated by the Python Compiler.
How do you invoke the Python interpreter for interactive use?
By using python or "pythonx, y" we can invoke a Python interpreter where "x, y" is the version of the Python interpreter.
Define String in Python?
String in Python is formed using a sequence of characters. Value once assigned to a string cannot be modified because they are immutable objects. String literals in Python can be declared using double quotes or single quotes.
How do you create a Python function?
Functions are declared using the def statement.
e.g. def food(mandu):
Define iterators in Python?
In Python, an iterator can be defined as an object that can be iterated or traversed upon. In another way, it is mainly used to iterate a group of containers, elements, the same as a list.
How does a function return values?
Functions return using the return statement.
Define slicing in Python?
Slicing is a procedure used to select a particular range of items from sequence types such as Strings, lists, and so on.
How can Python be an interpreted language?
As in Python the code which we write is not machine-level code before runtime so, this is the reason why Python is called an interpreted language.
What happens when an interpreted language does not have a return statement? Is this valid?
Yes, this is valid. The function will then return None object. The end of a function is defined by the block of code that is executed (i.e. the indenting) not by any explicit keyword.
Define package in Python?
In Python, packages are defined as the collection of different modules.
Which command is used to delete files in Python?
OS.unlink(filename) or OS.remove(filename) are the commands used to delete files in Python programming.
Explain the difference between local and global namespaces?
Local namespaces are created within a function when that function is called. Global namespaces are created when the progam starts.
What is a boolean in Python?
Boolean is one of the built-in data types in Python, it mainly two values and they are True and False. Python bool() is the method used to convert a value to a boolean value.