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
58
14
259
34.4K
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr The replace() method in Python returns a copy of the string where all occurrences of the substring are replaced with the new substring. Answer: (b) chpcplate Explanation: The original string is s = 'chocolate'. The code s.replace('o', 'p') replaces
English
2
0
22
2.1K
Omo Yewa
Omo Yewa@AceKelm·
@PythonPr B. The replacement method replaces all occurrences of 'o' with 'p'. Hence the answer.
English
0
0
6
1.4K
War, the Second.
War, the Second.@_WarXFamine_·
@PythonPr I don't know which is why i follow you so now if you know please explain it to me
English
1
0
2
388
DailyCodeflow
DailyCodeflow@DailyCodeflow·
@PythonPr B) chpcplate replace() doesn’t stop at the first match — it replaces all 'o' characters with 'p' in the string.
English
0
0
0
1
Paylaş