@@ -37,13 +37,26 @@ print '\n'.join(['%s,%s' % (k, v) for k, v in dic.items()])
37
37
----------------
38
38
** My Solution: Python 3**
39
39
``` python
40
- # to be written
40
+ import string
41
41
42
+ s = input ()
43
+ for letter in string.ascii_lowercase:
44
+ cnt = s.count(letter)
45
+ if cnt > 0 :
46
+ print (" {} ,{} " .format(letter,cnt))
47
+ ```
48
+ ** OR**
49
+ ``` python
50
+ s = input ()
51
+ for letter in range (ord (' a' ),ord (' z' )+ 1 ): # ord() gets the ascii value of a char
52
+ letter = chr (letter) # chr() gets the char of an ascii value
53
+ cnt = s.count(letter)
54
+ if cnt > 0 :
55
+ print (" {} ,{} " .format(letter,cnt))
42
56
```
43
57
---------------------
44
58
45
59
46
-
47
60
# Question 91
48
61
49
62
### ** Question**
@@ -73,8 +86,9 @@ print s
73
86
----------------
74
87
** My Solution: Python 3**
75
88
``` python
76
- # to be written
77
-
89
+ s = input ()
90
+ s = ' ' .join(reversed (s))
91
+ print (s)
78
92
```
79
93
---------------------
80
94
@@ -107,8 +121,18 @@ print s
107
121
----------------
108
122
** My Solution: Python 3**
109
123
``` python
110
- # to be written
111
-
124
+ s = " H1e2l3l4o5w6o7r8l9d"
125
+ s = [ s[i] for i in range (len (s)) if i% 2 == 0 ]
126
+ print (' ' .join(s))
127
+ ```
128
+ ** OR**
129
+ ``` python
130
+ s = " H1e2l3l4o5w6o7r8l9d"
131
+ ns = ' '
132
+ for i in range (len (s)):
133
+ if i % 2 == 0 :
134
+ ns+= s[i]
135
+ print (ns)
112
136
```
113
137
---------------------
114
138
@@ -125,20 +149,13 @@ print s
125
149
126
150
----------------------
127
151
128
- ** Main author's Solution: Python 2 **
152
+ ** Solution:**
129
153
``` python
130
154
131
155
import itertools
132
156
print list (itertools.permutations([1 ,2 ,3 ]))
133
157
```
134
158
----------------
135
- ** My Solution: Python 3**
136
- ``` python
137
- # to be written
138
-
139
- ```
140
- ---------------------
141
-
142
159
143
160
144
161
# Question 94
@@ -155,7 +172,7 @@ We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many
155
172
156
173
----------------------
157
174
158
- ** Main author's Solution: Python 2 **
175
+ ** Solution:**
159
176
``` python
160
177
def solve (numheads ,numlegs ):
161
178
ns= ' No solutions!'
@@ -171,11 +188,3 @@ solutions=solve(numheads,numlegs)
171
188
print solutions
172
189
```
173
190
----------------
174
- ** My Solution: Python 3**
175
- ``` python
176
- # to be written
177
-
178
- ```
179
- ---------------------
180
-
181
-
0 commit comments