+ 1
Write A program to swap consecutive characters of the input given by user (in python)
'ball'=abll , 'dog'=odg
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
0
Treat the first two letters of the stdin as regular variables and do a classin interchange ^^