What will be the output of the following Python code?
import time
for i in range(0,5):
print(i)
time.sleep(2)
import time
for i in range(0,5):
print(i)
time.sleep(2)A. After an interval of 2 seconds, the numbers 1, 2, 3, 4, 5 are printed all together
B. After an interval of 2 seconds, the numbers 0, 1, 2, 3, 4 are printed all together
C. Prints the numbers 1, 2, 3, 4, 5 at an interval of 2 seconds between each number
D. Prints the numbers 0, 1, 2, 3, 4 at an interval of 2 seconds between each number
Answer: Option D
A. A file containing Python code that can be reused
B. A keyword in Python
C. A built-in data type
D. A type of exception
How can you use a module in Python?
A. By importing it using the import statement
B. By defining it with the module keyword
C. By including it as a string
D. By using the use_module function
What is the purpose of the import statement in Python?
A. It allows you to use functions and objects defined in a module
B. It creates a new module
C. It imports a module from another programming language
D. It is used to define a new class
What does the as keyword do when used with the import statement?
A. It renames the imported module or object
B. It imports a module as a string
C. It imports all modules in the current directory
D. It creates an alias for the import keyword

Join The Discussion