0% found this document useful (0 votes)
6 views1 page

Python Module

The document discusses various aspects of Python modules, including their definition and advantages. It explains different import statements with examples, analyzes a code snippet for possible outputs, and identifies necessary library modules for specific functions. Additionally, it differentiates between the round() and floor() functions and presents a code example for generating random numbers.

Uploaded by

gamerxsk786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Python Module

The document discusses various aspects of Python modules, including their definition and advantages. It explains different import statements with examples, analyzes a code snippet for possible outputs, and identifies necessary library modules for specific functions. Additionally, it differentiates between the round() and floor() functions and presents a code example for generating random numbers.

Uploaded by

gamerxsk786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What is Module? What are the advantages of it?

2. How the following import statements are different, explain with programming examples:
o import X
o from X import *
o from X import a,b

3. Consider the following code :


1 import math
2 import random
3 print(str(int([Link]([Link](2,4),2))), end =" ") #Statement1
4 print(str(int([Link]([Link](2,4),2))), end =" ") #Statement2
5 print(str(int([Link]([Link](2,4),2)))) #Statement3
What could be the possible outputs out of the given choices, also state the reason for each option,
why?
o 234
o 944
o 16 16 16
o 249
o 494
o 444

5. What is the Extension of python library Module:


(a) .mod (b) .lib (c) .code (d) .py
6. Name the Python Library modules which need to be imported to invoke the following functions:
(a) ceil( ) (b) randint( )

7. Differentiate between the round() and floor() functions with the help of suitable example

[Link] possible output(s) are expected to be displayed on screen at the time of execution of the
program from the following code?

import random
AR = [ 20, 30, 40, 50, 60, 70]
FROM = [Link] (1, 3)
TO = [Link] (2, 4)
for K in range (FROM, TO+1):
print (AR[K], end = "#")
(a) 10#40#70#
(b) 30#40#50#
(c) 50#60#70#
(d) 40#50#70#

(8) Program to generate 50 random numbers between 100 to 1000.

You might also like