-2

Let's say I have an input:

SA3213023215     

I want to move the SA to the very end of the input.
How can I do this?

martineau
  • 119,623
  • 25
  • 170
  • 301
K.Kim
  • 9
  • 3
  • 1
    " i already tried so much" <- please show us – timgeb Nov 01 '18 at 17:37
  • 1
    Possible duplicate of [Is there a way to substring a string in Python?](https://stackoverflow.com/questions/663171/is-there-a-way-to-substring-a-string-in-python) and maybe [Ways to slice a string?](https://stackoverflow.com/questions/1010961/ways-to-slice-a-string) or [How to move the first letter of a word to the end](https://stackoverflow.com/questions/12924009/how-to-move-the-first-letter-of-a-word-to-the-end). So many to choose from. – pault Nov 01 '18 at 17:38
  • Do you always have the input beginning with two characters (like SA) or does it vary? – Jack Moody Nov 01 '18 at 17:39
  • the input does always have the two characters at the beginning. i tried it with extend, append range and all but it didnt work. – K.Kim Nov 01 '18 at 17:41
  • like this IBAN = input("Bitte geben sie ihre IBAN ein:") IBAN.append(IBAN in range(0,1)) print(IBAN) – K.Kim Nov 01 '18 at 17:42
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. [On topic](http://stackoverflow.com/help/on-topic), [how to ask](http://stackoverflow.com/help/how-to-ask), and [... the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) apply here. StackOverflow is not a design, coding, research, or tutorial resource. Among other things, we expect you to carry out due diligence before posting here: research first, *then* post. – Prune Nov 01 '18 at 17:43

1 Answers1

3

Assuming that SA3213023215 is a string (which input is by default), you could use string slicing:

s = "SA3213023215"
s2 = s[2:] + s[:2]
# yields 3213023215SA
infobiac
  • 163
  • 9