x = "Hello"
print(type(x))
Right Answer:
The code snippet prints the data type of the variable “x”, which is a string. The correct type name in Python is “str”.
Right Answer:
The code snippet prints the data type of the variable “x”, which is a string. The correct type name in Python is “str”.
Right Answer:
The code snippet converts the string “20” to an integer using the int() function and then adds it to the integer value of “x”. Therefore, the output will be 30.
Right Answer:
The code snippet prints the data type of the variable “x”, which is a floating-point number. The correct type name in Python is “float”.
Right Answer:
The variable “x” is assigned a boolean value, so its data type is Boolean.
Right Answer:
The code converts the integer “x” to a string using the str() function and then concatenates it with the string “y”. Therefore, the output will be “1020”.
Right Answer:
The & operator is used for set intersection, which returns the common elements between two sets. Therefore, the output will be {“b”, “c”}.
Right Answer:
The code snippet prints the data type of the variable “x”, which is a set. The correct type name in Python is “set”.
x = {"apple", "banana", "cherry"}
print(type(x))
Right Answer:
The code snippet prints the data type of the variable “x”, which is a list. The correct type name in Python is “list”.
Right Answer:
Dictionaries in Python are used to store collections of items where each item is indexed by a key.
Right Answer:
Lists in Python are used to store collections of items where each item is indexed by a numerical index.