- 2
How to swap first character Between two string in python?
Sample ... <input> x="knowledge" y="zone" Sample ... <output> x="znowledge" y="kone"
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))])
+ 2
Use slicing;
https://code.sololearn.com/cu8MI4RRmdPp/?ref=app
0
Well, what will be the proposals?