PYTHON FAQ-1
PYTHON FAQ-1
1) What is Python? What are the benefits of using Python?
Python is a programming language with objects, modules, threads, exceptions and automatic memory management. The benefits of pythons are that it is simple and easy, portable, extensible, build-in data structure and it is an open source.
2) How Python is interpreted?
Python language is an interpreted language. Python program runs directly from the source code. It converts the source code that is written by the programmer into an intermediate language, which is again translated into machine language that has to be executed.
3 What are programming Language Paradigms?
There are two types of Programming Language Paradigms:
1. Imperative Paradigm
2. Declarative Paradigm
1. Imperative Paradigm:
It consists of commands for the computer to perform.
1. Procedural Programming Paradigm
It is based on the concept of using procedures. Example: C, Pascal
2. Object-oriented Programming Paradigm
It is based on the concept of "objects", Example: C++, JAVA
Declarative Paradigm:
A style of building the structure and elements of computer programs,without describing its control flow.
1. Functional Programming Paradigm
It is the process of building software by composing pure functions.
Example: LISP (List Processing)
2. Logical Programming Paradigm:
It is largely based on formal logic Example: PROLOG (Programming in Logic)
4) Explain PYTHON Run Modes?
1 Interactive Run mode
2 Script Run mode
5) Python print() detailed Syntax:
print(value1, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
print() Parameters
objects - object to the printed.
sep - objects are separated by sep. Default value: ' '
end - end is printed at last
file - must be an object with write(string) method.
flush - If True, the stream is forcibly flushed. Default value: False
6 )PSF, PEPs, PyPI stands for?
PSF ==> Python Software Foundation
PEPs ==> Python Enhancement Proposals
PyPI ==> Python Package Index
7) Write five implementations of the Python language?
1. CPython (Standard, implementation of Python)
2. Jython(Python for Java)
3. IronPython(Python for .NET)
4. Stackless (Python for concurrency)
5. PyPy(Python for speed)
8) Single Lone Underscore (_):
The most recent output value is automatically stored by the interpreter in a special variable with the name "_".
9) Display list of Keywords and version commands?
import keyword
print(keyword.kwlist)
import sys
print (sys.version)
or
import platform
platform.python_version()
10) What is Shebang?
The term shebang refers to the "#!" located at the top of many script files that points to the path of the associated program. It has the following alias Names:
1. She-bang
2. Hashbang
3. Pound-bang
4. Hash-pling
5. Crunchbang....etc..!!
The usage of #!/usr/bin/python plays a role if the script is executable, and called without the preceding language.
11 Components of Pycharm:
It has mainly the following Components:
1. Menu or Dashboard
2. Project Panel
3. Code Editor
4. Console or Output Window
12) What is Anaconda?
Anaconda is a freemium open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment
13 )PIP List
List installed packages, including editables. Packages are listed in a case-insensitive sorted order.
Syntax:
pip list [options]
14 What is an identifier?
An identifier is just the name of the variable. or An identifier as the label that names a variable
15) What is camelCase?
It has the following Alias Names:
1 Camel case
2 camelCase
3 CamelCase
4 camel caps
5 medial capitals etc.............!!
CamelCase is a naming convention in which a name is formed of multiple words that are joined together as a single word with the first letter of each of the multiple words capitalized for better readability.
Examples:"iPhone ", "eBay", "FedEx", "PayPal", etc...!!
16) Output of the following:
oct(32)==>'0o40'
hex(32)==> '0x20'
bin(32)==> '0b100000'
17) Output is 2*6**2 ==> 72
18 )What is a literal in Python? List of Python Literals?
A Literal is a constant value. The literals include the string, unicode string, integer, float, long, list, tuple and dictionary types.
Python support the following literals:
I. String literals:
String literals can be formed by enclosing a text in the quotes. We can use both single as well as double quotes for a String.
II.Numeric literals:
Numeric literals can belong to following four different numerical types.
1 Int(signed integers)
2 Long(long integers)
3 float(floating point)
4 Complex(complex)
III. Boolean literals:
A Boolean literal can have any of the two values: True or False.
IV. Special literals.
Python contains one special literal i.e., None.
V.Literal Collections.
Collections such as tuples, lists and Dictionary are used in Python.
19 )How to Clear screen in Windows and Unix
1. Using Keyboard shortcut: (UNIX)
Press CTRL + L
2. print("\n"*100) (in Windows)
3. clear="\n"*100
print(clear)
20 )Any five Python Core libraries for Data Science
Python's popularity for data science is largely due to the strength of its core libraries
1. NumPy==> It is the fundamental package for scientific computing with Python
2. SciPy ==> It contains modules for optimization, linear algebra, integration, interpolation etc.!
3. pandas ==> It is providing high-performance, easy-to-use data structures and data analysis tools
4 matplotlib ==> It is a Python 2D plotting library
5 IPython ==> It is an interactive command-line terminal for Python
21 )The following output
1 0b1001000 decimal is ==> 72
2 0o122 decimal is ==> 82
3 '0x5c' decimal is ==>92
Comments
Post a Comment