WorksheetsPython Enduro 25 - 3
Total questions: 8
Worksheet time: 4mins
What does random() function of random module do?
return a float between 0 and 1
return a float between the input numbers
return a int value between the input numbers
all of these
What is the correct syntax to use pi constant of Math module?
math.pi()
math.pi
math(pi)
pi()
Which of the following data structure is not indexed by position?
List
Tuple
Dictionary
None of these
What will be the output of the given code?
9
8
7
6
print(student[1])
print(student.rol_no)
print(student.get(1))
print(student['roll_no'])
return the file abc.txt
rewrite the file in text mode
open the file in read only mode
rewrite the file abc.txt
create a list of lines in the file
store the file contents in a string
create a dictionary of lines in the file
stores each line of file as different file
Which function is used select a random item from a list?
random.choice()
list.random()
list.choose()
math.random()
