This group handles many functions that are available for all Python versions.
The math module provides standard mathematical functions and constants. It doesn't accept complex numbers, only integers and floats. Check out the following example:import math
The cmathmodule also provides standard mathematical functions and constants. However, its implementation enables it to accept complex numbers as arguments. All the returned values are expressed as complex numbers.
The random module generates pseudo-random numbers. This module implements all the randomizing functions provided by the whrandommodule plus several pseudo-random real number generators.
These random modules aren't very secure for encryption purposes.
It randomly picks one element from list. basic syntax: random.choice(list)
>>>lst = ["A","l","b","a","t","r","o","s","s","!","!"]
>>> while lst:
… element = random.choice(lst)
… print element, # inserts a linefeed
b l o A s r ! ! t s a
It returns a random floating-point number between 0.0 and 1.0. basic syntax: random.random()
It returns a random integer n, where x <= N <= y.
basic syntax: random.randint(x,y)
The whrandommodule provides a Wichmann-Hill floating-point pseudo-random number generator. This module is mostly useful when you need to use multiple independent number generators.
This function initializes multiple random generators using the same seed.>>> import whrandom
The bisect module has an array bisection algorithm that provides support for keeping lists in sorted order without the need for sorting them out all the time.
The array module is a high efficiency array implementation that handles large lists of objects. The array type is defined at the time of creation. By using this module, you can create an ArrayTypeobject that behaves exactly like any other list, except that it isn't recommended for storing elements of different types.>>> import array
This was a string Note that NumPyprovides a superior array implementation, which can be used for more than just numeric algorithms.
Note that Python 2.0 has improved the array module, and new methods were added to its array objects, including: count(), extend(), index(), pop(), and remove().
The ConfigParsermodule is a basic configuration file parser that handles structures similar to those found in the Microsoft Windows INI file.
The fileinputmodule helps you by writing a loop that reads the contents of a file, line by line.>>> import fileinput
The calendar module provides general calendar-related functions that emulate the UNIX cal program, allowing you to output calendars, among other things.
The cmdmodule is a simple interface used as a framework for building command line interpreters and shells. You just need to subclass its cmd.Cmdclass in order to create your own customized environment.
The shlexmodule helps you write simple lexical analyzers (tokenizers) for syntaxes that are similar to the UNIX shell.
Python Related Interview Questions
|Perl Scripting Interview Questions||C++ Interview Questions|
|PHP Interview Questions||C Interview Questions|
|Ruby on Rails Interview Questions||Ruby Interview Questions|
|Django Interview Questions||Lisp programming Interview Questions|
|R Programming language Interview Questions||wxPython Interview Questions|
|Python Automation Testing Interview Questions|
Extending And Embedding Python
Objects Interfacing And Distribution
Working With Databases
Other Advanced Topics
Basic Network Background
Python And Guis
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.