Sumita Arora Solution

What is the difference between “w” and “a” modes?

“w” and “a” are fie modes which determines the type of operation to be done on data file. Both are used for writing data in a file. The difference between them is- – In “a” mode existing data of file is retained and new data is inserted at the end.– In “w” mode existing data

What is the difference between “w” and “a” modes? Read More »

Explain the difference between import and from import statement, with example.

import <module> It import entire module and so everything inside the module will be imported like functions, constant, variables.In this way after importing the module we can use any function of imported module as per given syntax-module.<functionname>() For example import mathprint(math.pi)print(math.sum([10,20])) from <module> import statement from <module> import statement imports selected items , but to

Explain the difference between import and from import statement, with example. Read More »

What do you understand by standard library of Python?

Standard library is built in library with predefined modules in python. It is automatically installed with python installation and we can access any object of these module without referring their module name and dot notation. Some common module of python standard library are- Math N NumPy SciPy tkniter Matplotlib

What do you understand by standard library of Python? Read More »

Why should the form import statement be avoided to import objects?

We should avoid importing any object like from <module> import <object> because in this way object is added in current namespace and if any existing variable’s name resembles with the variable imported via module, so imported variable is ignored.

Why should the form import statement be avoided to import objects? Read More »

How are following import statement different?
(i) import X (ii) from X import * (iii) from X import a,b,c

import X It import entire X module and so everything inside the X module will be imported like functions, constant, variables.In this way after importing the module we can use any function of X as per given syntax-X.<functionname>() from X import * It import entire X module with all items, but to use these items

How are following import statement different?
(i) import X (ii) from X import * (iii) from X import a,b,c
Read More »

error: Content is protected !!