What is the correct way to take integer input from the user in Python?
raw_input()
input()
input(int())
int(input())
What will this code snippet print?
x = 10 if x > 5: if x < 15: print('Yes') else: print('No')
An error message
Yes
YesNo
No
Which of the following data structures in Python is mutable?
Tuple
List
None of the above
String
How many times will the word 'Hello' be printed?
i = 0 while i < 3: print('Hello') i += 1
3
4
Infinitely
2
How many times will the following loop iterate?
for i in range(3, 8): print(i)
7
5
8
What will the variable 'x' hold after this code executes?
x = 5 x %= 2
2.5
1
Which of the following is NOT a valid way to format a string in Python?
format() method
format()
% operator
%
concat() function
concat()
f-strings
What does the following code accomplish?
sum = 0 for i in range(1, 6): sum += i print(sum)
Prints the numbers from 1 to 5
Calculates the sum of numbers from 1 to 5
Finds the largest number between 1 and 5
Calculates the factorial of 5
What is the value of the expression: '5' + '3'?
'5' + '3'
Error
15
53
What will the following Python code snippet print?
x = 5 if x > 10: print('A') elif x > 3: print('B') else: print('C')
A
C
The code will result in an error.
B