- 2

How to swap first character Between two string in python?

Sample ... <input> x="knowledge" y="zone" Sample ... <output> x="znowledge" y="kone"

24th May 2021, 8:52 AM
Md Abu Taher
Md Abu Taher - avatar
3 Answers
+ 1
Maybe there are easier ways, but it works: x="knowledge" y="zone" print(y[0]+x[1:(len(x))]) print(x[0]+x[1:(len(y))])
24th May 2021, 9:47 AM
Angela
Angela - avatar
24th May 2021, 9:46 AM
ChaoticDawg
ChaoticDawg - avatar
0
Well, what will be the proposals?
24th May 2021, 9:19 AM
Solo
Solo - avatar