What is the correct way to access the third element of a list named 'my_list' in Python?
my_list[3]
my_list(2)
my_list.get(3)
my_list[2]
What will this code print?
for i in range(3): for j in range(2): print('*', end='') print()
** ** **
What is the output of the following Python code snippet?
print(10 / 3)
Error
3.3333333333333335
3
3.0
What will the following Python code print to the console?
name = input("Enter your name: ") print("Hello,", name)
Hello, [user's input]
It will print nothing.
Enter your name:
Enter your name: Hello, [user's input]
What happens if a function doesn't explicitly use the 'return' keyword?
The function will return a random value.
The function will raise a SyntaxError.
The function will enter an infinite loop.
The function will return 'None'.
What is the correct way to concatenate two strings, 'Hello' and 'World!', with a space in between?
'Hello' & ' ' & 'World!'
'Hello' + 'World!'
'Hello' + ' ' + 'World!'
"Hello" + " " + "World!"
What is the output of the following Python code?
my_list = [1, 2, 3, 4, 5] print(my_list[1:3])
[1, 2]
[2, 3]
[1, 2, 3]
[3, 4]
What will the following Python code snippet print?
x = 5 if x > 10: print('x is greater than 10') elif x > 3: print('x is greater than 3') else: print('x is less than or equal to 3')
x is less than or equal to 3
x is greater than 3
x is greater than 10
How many times will the word 'Hello' be printed?
for i in range(3): print('Hello')
0
1
2
Which assignment operator in Python is used to perform floor division and assign the result?
%=
=
//=
/=