Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
21
21
144
11.1K
Slinxs
Slinxs@JSlinxsx·
@PythonPr The correct answer is: ✅ (b.) The sum of 5 and 10 is 15 Why?: ▫️ str.format() substitutes {} placeholders with the values passed in the same order, here, x, y, and z.
English
0
0
0
553
Prem Prakash
Prem Prakash@4EverPrem·
@PythonPr B but I would rather use f strings. print(f"The sum of {x} and {y} is {x + y}") Using f strings makes z = x +y redundant.
English
0
0
0
294
Tim
Tim@Timtimooya·
@PythonPr B. Format() helps to put declared variables in the curly brackets
English
0
0
0
260
Paylaş