Home >>Interview Questions >Python Interview Questions and Answers
Ans : Python is an example of open source software. It is an shell scripting and interpreted language . Python is a dynamically typed language.
APPLICATION ARE:- Applications of python are Data Analysis, Data Science, Desktop based Application,Website Designing.
Ans : PYTHONPATH has a role similar to PATH. This variable tells Python translator where to locate the module files imported into a program.
Ans : There are five supported data types in python language:
Lists | Tuples |
---|---|
Lists are variable, i.e., they can be edited. | These Tuples are immutable that means that are the lists which cannot be edited. |
Lists are generally slower than tuples. | Tuples are faster than lists. |
Syntax: list2 = [20, 'python', 30] | Syntax: tuple = (20, 'python' , 30) |
Ans : A string in Python is a order of alpha-numeric characters. They are immutable objects. It means that they don’t allow variation once they get assigned a value. Python provides various methods, such as join(), replace(), or split() to alter strings. But none of these change the original object.
a) abc = 4,500,000 b) a b c = 6000 3000 2000 c) a, b, c= 7000, 3000, 7000 d) a_b_c = 7,330,000
Ans : Tkinter is an inbuilt Python module that is used to create graphical user interface applications.. We can start using it by importing it in our script.
Ans : Indentation in Python is mandatory and is part of its syntax. All programming languages have few way of defining the scope and limit of the block of codes; in Python, it is indentation. Indentation provides better readability to the code, which is probably why Python has made it mandatory .
Ans : MySQL (Structured) and MongoDB (Unstructured) are the famous databases that are supported in Python. Import the module and start using the functions to interact with the database.
Ans : MySQL (Structured) and PostgreSQL are the famous databases that are supported in Python. Import the module and start using the functions to interact with the database.
Ans :
from datetime import datetime time = datetime.now() currenttime = time.strftime("%H:%M:%S") print("Current Time =", currenttime)
Ans : locals function is accessed inside the function and it returns all names that can be accessed locally from that function. Globals function returns all names that can be accessed globally from that function.
Ans : It is a kind of assignment which swap 2 variables without using 3rd variable.
a=20 b=10 a,b = b,a this is a parallel assignment
Ans :
Python 2x | Python 3x |
---|---|
Libraries are not compatible. | ibraries are more compatible. than 2x |
Print function uses as print"abc". | Print function uses as print("abc"). |
It uses xrange function instead of range function. | It uses range function instead of xrange function. |
It uses floor value(which neglects the remainder). | It uses float value(which accept the remainder). |