What will be the output of the following Python code? [code]s='%s, %s & %s' s%('mumbai', 'kolkata', 'delhi')[/code]

Ngân Lam

New member
What will be the output of the following Python code?
Code:
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
A. mumbai kolkata & delhi
B. Error
C. No output
D. ‘mumbai, kolkata & delhi’
 
Answer: d
Explanation: In the code shown above, the format specifier %s is replaced by the designated substitution. Hence the output of the code shown above is: ‘mumbai, kolkata & delhi’.
 

Tìm kiếm

Back
Top