Print prime index characters in a string
Problem to find the prime number index characters.
Example-1:
Input : n = "mycrazycoding" Output : crzcn Explain : Prime indexes are 2,3,5,7,11. So output is "crzcn".
Example-2:
Input : n = "Helloworld" Output : llwr Explain : Prime indexes are 2,3,5,7. So output is "llwr".
Solution
n = "mycrazycoding" m = len(n) l = [] d = "" for i in range(2,m): for j in range(2,i): if(i % j == 0): break else: l.append(i) for x in l: d += n[x] print(d)
Output
crzcn