2017-10-23 6 views

Antwort

0

Sie können kombinieren verwenden, um eine deque:

from collections import deque 
word = "hello" 
d = deque(list(word)) 
d.rotate(-3) 
print(''.join(d)) 

Ausgang:

lohel 
0

können Sie Scheiben erstellen und

s = 'hello' 
n = 2 
s[n:]+s[:n] 
'llohe' 

n = 3 
s[n:]+s[:n] 
'lohel' 
0
def char_switch(str, shifts): 
    new_str = str[shifts:] + str[:shifts] 
Verwandte Themen