2. In Python, what does the % operator do when used for string formatting?
3. Which of the following is an f-string in Python?
4. What will be the output of the following Python expression if x=22.19?
print("%5.2f"%x)
print("%5.2f"%x)
5. The expression shown below results in an error.
print("-%5d0",989)
print("-%5d0",989)
6. In Python, what does the expression {:.2e} do in a formatted string?
7. What is the purpose of the @wraps decorator in Python's functools module?
8. What will be the output of the following Python code?
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
9. What will be the output of the following Python code?
'%x %d' %(255, 255)
'%x %d' %(255, 255)
10. What will be the output of the following Python code?
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
class A:
@staticmethod
def a(x):
print(x)
A.a(100)