RenzCutie

StringSwap

Sep 28th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. inStr = input("Enter a string seperated by a space: ").split(" ")
  2.  
  3. tmpFinal = ""
  4. for i in range(len(inStr)):
  5.     if i == 0: tmpStr2 = inStr[1]
  6.     else: tmpStr2 = inStr[0]
  7.  
  8.     tmpStr = inStr[i]
  9.     tmpFinal +=  tmpStr2[:2] + tmpStr[2:] + " "
  10.  
  11. print(tmpFinal)
Advertisement
Add Comment
Please, Sign In to add comment