-
Notifications
You must be signed in to change notification settings - Fork 1
/
ex_5.py
47 lines (44 loc) · 839 Bytes
/
ex_5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
""" '''
reverse a string without reversing the special characters.
eg:
input: abc$d%e
output: edc$b%a
'''
n = input()
pos = dict()
new = list()
final = list()
for i in range(len(n)):
if n[i].isalnum():
new.append(n[i])
else:
pos[i] = n[i]
new = new[::-1]
j = 0
for i in range(len(n)):
if i in pos.keys():
final.append(pos[i])
else:
if len(new) == 0:
pass
else:
final.append(new[j])
j+=1
print(''.join(str(i) for i in final))
"""
import matplotlib.pyplot as plt
import numpy as np
plt.ion() ## Note this correction
fig=plt.figure()
plt.axis([0,1000,0,1])
i=0
x=list()
y=list()
while i <1000:
temp_y=np.random.random();
x.append(i);
y.append(temp_y);
plt.scatter(i,temp_y);
i+=1;
plt.show()
plt.pause(0.0001)