HOME

  1. what is python?

Python is interpreted and high level dynamic programming language which was originated in the year of late 1980s but it was implemented in December 1989 by Guido Van Rossum.


  1. what are Features of python?

  • simplicity

  • opensource

  • portability

  • embeddable

  • interpreted

  • huge libraries

  • object orientation structure


  1. what are data-types of python?

  • integers

  • strings

  • lists

  • tuples

  • sets

  • dictionary


  1. what are operators of python?

  • Arithmetic operators

  • Assignment operators

  • Comparison operators

  • Logical operators

  • Identity operators

  • Membership operators

  • Bitwise operators


  1. what does operator mean in python?

Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand.


  1. what is index in python?

index() is an inbuilt function in Python, which searches for a given element from the start of the list and returns the lowest index where the element appears.


  1. what is integer in python?

Integers are whole numbers, such as 1, 20, 3000, 10200305, etc. They are declared simply by writing a whole number. For example, the statement x = 5 will store the integer number 5 in the variable x.


  1. what is string in python?

String is sequence of Unicode characters. We can use single quotes or double quotes to represent strings.


  1. what is list in python?

list is an ordered sequence of items. It is one of the most used datatype in Python and is very flexible. All the items in a list do not need to be of the same type. we can use square brackets to represent list.


  1. what is tuples in python?

Tuple is an ordered sequence of items same as a list. The only difference is that tuples are immutable. Tuples once created cannot be modified.


  1. what is sets in python?

Set is an unordered collection of unique items. Set is defined by values separated by comma inside braces { }. Items in a set are not ordered.


  1. what is dictionary in python?

Dictionary is an unordered collection of elements. The elements in dictionaries are stored as key–value pairs. Dictionaries are indexed by keys.


  1. What is membership and identity operators in Python?

As the name explains the membership operators are used to validate the membership of a value. Identity operators are used to verify if two variables point to the same memory location or not.


  1. what is local variable?

Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.


  1. what is global variable?

Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program.


  1. what do you mean by literals in python?

Literals can be defined as a data which is given in a variable or constant. Python supports the following literals:

  • string literals

  • numeric literals

  • Boolean Literals


  1. what do you mean by function in python?

A function is a section of the program or a block of code that is written once and can be executed whenever required in the program. python supports following functions:

  • built-in functions

  • user-defined functions


  1. what is the need for writing a function in a python?

  • All the logically related statements can be grouped together in one entity. This makes the program easy to read and understand.

  • The repetition of frequently required code can be avoided by using function.

  • Dividing a long program into functions allows us to debugs the part one at a time.

  • Once the code of the function is written and tested. we can reuse this code. Hence we can save our time.


  1. what is namespace in python?

A naming system used to make sure that names are unique to avoid naming conflicts refers to as Namespace.


  1. what do you mean by variable in python?

A variable is a named location used to store data in the memory. it works as a container that holds data that can be changed later in the program.


  1. what do you mean by continue statement in python?

The continue statement is used to skip the rest of the code inside a loop for the current iteration only.


  1. what do you mean by break statement in python?

This statement immediately terminates the loop entirely, and the control flow of the program is shifted directly to the outside of the loop.


  1. what do you mean by pass statement in python?

Pass means, no-operation Python statement, or in other words it is a place holder in compound statement.


  1. what do you mean by iterators in python?

Iterators are the collection of items, and it can be a list, tuple, or a dictionary.


  1. what do you mean by slicing in python?

Slicing is a mechanism used to select a range of items from sequence type like list, tuple, and string.


  1. what is the difference between list and tuple.

The difference between list and tuple is that a list is mutable while tuple is immutable.


  1. does python is intermediate language?

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.


  1. What is negative index in Python?

Python sequences can be index in positive and negative numbers. For positive index, 0 is the first index, 1 is the second index and so forth. For negative index, (-1) is the last index and (-2) is the second last index and so forth.


  1. what is module in python?

In Python, module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes.


  1. what is the use of split function in python?

The use of the split function in Python is that it breaks a string into shorter strings using the defined separator. It gives a list of all words present in the string.


  1. what is PEP8?

PEP 8 is a coding convention, a set of recommendation, about how to write your Python code more readable.


  1. what is pickling and un-pickling?

Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling.


  1. what are python decorators?

A Python decorator is a specific change that we make in Python syntax to alter functions easily.


  1. what do you mean by encapsulation in python?

Encapsulation means binding the code and the data together. A Python class in an example of encapsulation.


  1. what are the rules for create a variable?

  • A variable name must start with a letter or the underscore character

  • A variable name cannot start with a number

  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )

  • Variable names are case-sensitive (age, Age and AGE are three different variables)


  1. what do you mean by casting in python ?

casting is a process of converting a variable value from one type to another.


  1. what do you mean by strip method in python?

Python string method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string.


  1. what is the use of while loop in python?

The while loop in Python is used to iterate over a block of code as long as the test condition is true.


  1. what is python path?

PYTHONPATH is an environment variable which you can set to add additional directories where python will look for modules and packages. For most installations, you should not set these variables since they are not needed for Python to run.


  1. which are mutable and immutable built-in data types in python?

Immutable built-in datatypes of Python

  • Numbers

  • Strings

  • Tuples

Mutable built-in data types

  • List

  • Dictionaries

  • Sets


  1. what is the difference between Arrays and list?

Arrays and list in Python, have the same way of storing data. but arrays can hold only a single data type elements whereas lists can hold any data type elements.


  1. ~x is equivalent to -(x+1)


  1. What is lambda function in python?

‘lambda’ is a keyword in python which creates an anonymous function. Lambda does not contain block of statements. It does not contain return statements.


  1. What are the applications of Python?

  1. Django (Web framework of Python).

2. Micro Frame work such as Flask and Bottle.

3. Clone and Django CMS for advanced content Management.


44. What is the difference between remove() function and del statement?

You can use the remove() function to delete a specific object in the list.

If you want to delete an object at a specific location (index) in the list, you can either use del or pop.


45. What is swapcase() function in the Python?

It is a string's function which converts all uppercase characters into lowercase and vice versa.


46. what is indentation in python?

Leading white space at the beginning of the logical line is called indentation.


47.what is comments in python?

Comments are the kind of statements that are written in the program for program understanding purpose.


48. what is nested if in python?

When one if condition is present inside another if then it is called nested if condition.


49. what is nested loop?

Nested loops are the loop structure in which one loop is present inside the other loop.


50. What is argument?

Argument is a value that is passed to the function when it is called.


51. what is file in python ?

File is a named location on disk to store information. File is basically used to store the information permently on secondary memory.


52. what is readLines() method in file operation ?

The readLines() method used to print all the lines in the program.


53. CSV stands for Comma Separated Value.


54. What is the advantage of micropython?

MicroPython is a tiny open source Python programming language interpreter that runs on small embedded development boards. With MicroPython you can write clean and simple Python code to control hardware instead of having to use complex low-level languages like C or C++


55. what is the difference between micropython and python?

MicroPython does not support the entire python standard library. If a module is missing it will be due to the in-applicability of that module for use in an embedded controller. High memory consumption or a lack of a certain required hardware feature (e.g. multiprocessing) are reasons that some modules can not be implemented for some microcontrollers.


56. what is def statement in python?

A function in Python is defined by a def statement. The general syntax looks like this: def function-name(Parameter list):


57. what is call by value and call by reference?

  • While calling a function, we pass values of variables to it. Such functions are known as “Call By Values”.

  • While calling a function, instead of passing the values of variables, we pass address of variables(location of variables) to the function known as “Call By References.


58. what is class or static variable in python?

When we declare a variable inside a class but outside any method, it is called as class or static variable in python.


59. what is split in python?

The split() method is used to split a string into an array of substrings, and returns the new array.


60. How do we use in Membership operator?

In Operator: The in operator in Python is used to check if the value exists in a variable or not. When evaluated, if the operator finds a value then it returns true otherwise false.


61. How do you copy a text in python?

To copy text to the clipboard, pass a string to pyperclip. copy() . To paste the text from the clipboard, call pyperclip. paste() and the text will be returned as a string value.


62. What is the difference between parameters and arguments ?

A parameter is a variable defined inside a function's parenthesis.

An argument is the actual value you pass the function when it is called.


63. What is Calling the function ?

The process of activating the function is called calling the function.


64. What is Iteration ?

Repeated execution of a set of statements is called iteration.