Skip to content

Commit 4213246

Browse files
committed
Plain_temp updated
1 parent df5536d commit 4213246

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

palin_temp.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
from collections import Counter
3+
while True:
4+
str = list(input("Please enter the string to check\n"))
5+
c = Counter(list(str))
6+
# print(c)
7+
tt = []
8+
for k in str:
9+
if k not in tt:
10+
tt.append(k)
11+
# st = set(str)
12+
temp_l=[]
13+
for i in list(tt):
14+
# print(c[i])
15+
if c[i]in [j for j in range(0,22) if j%2 !=0]:# == 1 or c[i]==3 or c[i]==5:
16+
if str[len(str)//2] == i:
17+
# print("ig",i)
18+
pass
19+
else:
20+
# print("el")
21+
temp_l.append(i)
22+
# print(str)
23+
str.remove(i)
24+
# print(str)
25+
26+
27+
# print(temp_l)
28+
# print(str[::-1])
29+
# print(str)
30+
if str == str[::-1]:
31+
pass
32+
else:
33+
temp_l.append(str[len(str)//2-1])
34+
# To make a palindrome
35+
# temp = str[len(str)//2]
36+
# str[len(str)//2] = str[len(str)//2-1]
37+
# str[len(str)//2-1] = temp
38+
# print(str)
39+
if len(str)<3:
40+
print("not possible")
41+
else:
42+
print("Items to be deleted: ", temp_l)
43+
print("Palindrome is:",str)

palindrome_creator.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
str = "eabcba"
2+
3+
4+
def PalindromeCreator(str):
5+
temp_l=[]
6+
n = len(str)
7+
rev=list(reversed(str))
8+
print(rev,list(str))
9+
for i in range(n-1):
10+
if(str[i] == rev[i]):
11+
pass
12+
else:
13+
if(str[i] == rev[i+1]):
14+
temp_l.append(str[i])
15+
else:
16+
temp_l.append(rev[i])
17+
print(temp_l)
18+
19+
PalindromeCreator(str)

pytr.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
string=input("Enter string:")
2+
if(string!=string[::-1]):
3+
s=set()
4+
for i in string:
5+
6+
if i not in s:
7+
s.add(i)
8+
9+
else:
10+
s.remove(i)
11+
12+
s1=" ".join(map(str,(i for i in s)))
13+
print(s1)
14+
15+
16+
else:
17+
print("The string a palindrome")

re_remove_dash_string.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fecth out the integers without hyphen and integers
2+
import re
3+
4+
5+
str = "11-22-33-44 trdtyj yutuyik"
6+
7+
d=(re.findall('\d+',str))
8+
print(''.join(d))

0 commit comments

Comments
 (0)