+ 1

Write A program to swap consecutive characters of the input given by user (in python)

'ball'=abll , 'dog'=odg

10th Nov 2016, 3:38 AM
Maxwell Miles
Maxwell Miles - avatar
2 Answers
+ 1
I know this post is old, but I found it and wanted to give it a go. Though I don't know exactly what you meant by 'consecutive'. Does that mean swapping 1&2, 3&4, 5&6, etc.? Or does it continually swap letters, 1&2, then 2&3, 3&4, etc.? I made the first one. https://code.sololearn.com/cLb40ew4hb0v/?ref=app
22nd May 2017, 2:58 PM
Jake
Jake - avatar
0
Treat the first two letters of the stdin as regular variables and do a classin interchange ^^
11th Nov 2016, 12:38 AM
Seckar
Seckar - avatar