Python Interview questions - formatting
(Python version 3.9 or later version)
Which of the following Python objects is immutable?
set
dict
list
str
Explanation
Please click here for explanation
What would be the result of executing the following code?
print
(
True
*
2
)
TrueTrue
True True
2
Syntax Error
Explanation
Please click here for explanation
Python Interview Questions
Python - Formatting
1. What is the format operator for defining you want 2 leading zeroes in output?
A) {02d}
B) {2d}
C) {:02d}
Answer: {:02d}
2. You can create an alias using the keyword?
A) as
B) from
C) alias
Answer: as