回答編集履歴
2
空白区切りの場合を追記
test
CHANGED
@@ -6,8 +6,24 @@
|
|
6
6
|
|
7
7
|
x = input('Please enter a string:')
|
8
8
|
|
9
|
-
x = x[-1] + x[:-1]
|
9
|
+
x = x[-1:] + x[:-1]
|
10
10
|
|
11
11
|
print(x)
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
空白で区切るなら split してから。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```python
|
22
|
+
|
23
|
+
x = input('Please enter a string:').split()
|
24
|
+
|
25
|
+
x = x[-1:] + x[:-1]
|
26
|
+
|
27
|
+
print(*x)
|
28
|
+
|
29
|
+
```
|
1
コード変更
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
x = input('Please enter a string:')
|
8
8
|
|
9
|
-
x = x[-1
|
9
|
+
x = x[-1] + x[:-1]
|
10
10
|
|
11
11
|
print(x)
|
12
12
|
|