What is the name of the user-defined function present in the following code snippet?*
import random
def test():
print("hello world")
randomNumber = random.randint(1, 10)
length = len("This is cool")
print(randomNumber, length)
test()
test
random
randint
len
The name of the user-defined function present in the code snippet is "test".
What does DRY stand for?*
Don’t Repeat Yourself
Do Repeat Yourself
Don’t Recall Yourself
Don’t Revise Yourself
DRY stands for "Don't Repeat Yourself".
What is the output of the following code snippet?*
def say_something():
print("I said something")
def print_something():
print("I printed something")
print_something()
I said something I printed something
I said something
I printed something
None of the options
The output of the following code snippet is:
"I printed something"
Which of the following built-in functions returns the length of a list?*
length()
min()
len()
max()
The built-in function that returns the length of a list is "len()".
Which of the following is not a relational operator?*
>=
!=
==
+=
The operator "+=" is not a relational operator. It is actually an assignment operator used for adding a value to a variable.
8. In the following code snippet, what should go in the ___ to loop through the `users` list?*
users = ["Daniel", "Ivann", "Natalie", "Kevin"]
for user in ___:
print(users)
user
users
list
None of the options