MENU
Question -

Give an example of “random()”



Answer -

The following example shows the usage of random() method.

# !/usr/bin/python
import random
# First random number
print “random(): ” ,
random.random() # Second random number print “random(): “,
random.random()
This will produce the following results
random(): 0.281954791393
random(): 0.309090465205

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×