1
+ {
2
+ "nbformat" : 4 ,
3
+ "nbformat_minor" : 0 ,
4
+ "metadata" : {
5
+ "colab" : {
6
+ "name" : " Rotate A String.ipynb" ,
7
+ "provenance" : [],
8
+ "collapsed_sections" : [],
9
+ "authorship_tag" : " ABX9TyP61Op8y4rL64CxJK6zfhJa" ,
10
+ "include_colab_link" : true
11
+ },
12
+ "kernelspec" : {
13
+ "name" : " python3" ,
14
+ "display_name" : " Python 3"
15
+ },
16
+ "language_info" : {
17
+ "name" : " python"
18
+ }
19
+ },
20
+ "cells" : [
21
+ {
22
+ "cell_type" : " markdown" ,
23
+ "metadata" : {
24
+ "id" : " view-in-github" ,
25
+ "colab_type" : " text"
26
+ },
27
+ "source" : [
28
+ " <a href=\" https://colab.research.google.com/github/natnew/Python-Projects-Rotate-A-String/blob/main/Rotate_A_String.ipynb\" target=\" _parent\" ><img src=\" https://colab.research.google.com/assets/colab-badge.svg\" alt=\" Open In Colab\" /></a>"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type" : " code" ,
33
+ "metadata" : {
34
+ "id" : " Wptx3tAml7z6"
35
+ },
36
+ "source" : [
37
+ " s = \" 100 Python projects\" "
38
+ ],
39
+ "execution_count" : 6 ,
40
+ "outputs" : []
41
+ },
42
+ {
43
+ "cell_type" : " code" ,
44
+ "metadata" : {
45
+ "colab" : {
46
+ "base_uri" : " https://localhost:8080/" ,
47
+ "height" : 35
48
+ },
49
+ "id" : " 9xb0XjBJl_t7" ,
50
+ "outputId" : " 5ae911d4-5fec-47d2-ba55-50507d1ab726"
51
+ },
52
+ "source" : [
53
+ " s[3:] + s[:3]"
54
+ ],
55
+ "execution_count" : 7 ,
56
+ "outputs" : [
57
+ {
58
+ "output_type" : " execute_result" ,
59
+ "data" : {
60
+ "application/vnd.google.colaboratory.intrinsic+json" : {
61
+ "type" : " string"
62
+ },
63
+ "text/plain" : [
64
+ " ' Python projects100'"
65
+ ]
66
+ },
67
+ "metadata" : {},
68
+ "execution_count" : 7
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "cell_type" : " code" ,
74
+ "metadata" : {
75
+ "colab" : {
76
+ "base_uri" : " https://localhost:8080/" ,
77
+ "height" : 35
78
+ },
79
+ "id" : " JIyCCzxmmCw3" ,
80
+ "outputId" : " 243d3373-1f79-4476-85de-e24919776989"
81
+ },
82
+ "source" : [
83
+ " s[-3:] + s[:-3]"
84
+ ],
85
+ "execution_count" : 8 ,
86
+ "outputs" : [
87
+ {
88
+ "output_type" : " execute_result" ,
89
+ "data" : {
90
+ "application/vnd.google.colaboratory.intrinsic+json" : {
91
+ "type" : " string"
92
+ },
93
+ "text/plain" : [
94
+ " 'cts100 Python proje'"
95
+ ]
96
+ },
97
+ "metadata" : {},
98
+ "execution_count" : 8
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "cell_type" : " code" ,
104
+ "metadata" : {
105
+ "colab" : {
106
+ "base_uri" : " https://localhost:8080/"
107
+ },
108
+ "id" : " 4caHnDimmEjN" ,
109
+ "outputId" : " df1bea43-28d8-4a0c-9ce3-f6c517c8adf6"
110
+ },
111
+ "source" : [
112
+ " from collections import deque\n " ,
113
+ " d = deque(s)\n " ,
114
+ " d.rotate(3)\n " ,
115
+ " d"
116
+ ],
117
+ "execution_count" : 9 ,
118
+ "outputs" : [
119
+ {
120
+ "output_type" : " execute_result" ,
121
+ "data" : {
122
+ "text/plain" : [
123
+ " deque(['c',\n " ,
124
+ " 't',\n " ,
125
+ " 's',\n " ,
126
+ " '1',\n " ,
127
+ " '0',\n " ,
128
+ " '0',\n " ,
129
+ " ' ',\n " ,
130
+ " 'P',\n " ,
131
+ " 'y',\n " ,
132
+ " 't',\n " ,
133
+ " 'h',\n " ,
134
+ " 'o',\n " ,
135
+ " 'n',\n " ,
136
+ " ' ',\n " ,
137
+ " 'p',\n " ,
138
+ " 'r',\n " ,
139
+ " 'o',\n " ,
140
+ " 'j',\n " ,
141
+ " 'e'])"
142
+ ]
143
+ },
144
+ "metadata" : {},
145
+ "execution_count" : 9
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "cell_type" : " code" ,
151
+ "metadata" : {
152
+ "colab" : {
153
+ "base_uri" : " https://localhost:8080/" ,
154
+ "height" : 35
155
+ },
156
+ "id" : " Sa83is1zmIOI" ,
157
+ "outputId" : " d9d413b2-3dbe-45c7-cea5-2ca277e35e13"
158
+ },
159
+ "source" : [
160
+ " \"\" .join(d)"
161
+ ],
162
+ "execution_count" : 10 ,
163
+ "outputs" : [
164
+ {
165
+ "output_type" : " execute_result" ,
166
+ "data" : {
167
+ "application/vnd.google.colaboratory.intrinsic+json" : {
168
+ "type" : " string"
169
+ },
170
+ "text/plain" : [
171
+ " 'cts100 Python proje'"
172
+ ]
173
+ },
174
+ "metadata" : {},
175
+ "execution_count" : 10
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ }
0 commit comments