<jupyter_start><jupyter_text>**Print the repeating characters**<jupyter_code>arr = [1, 2, 3, 4, 5, 4, 3, 1]
n = len(arr)
# repeted = []
for i in range(n):
    for j in range(i+1, n):
        if arr[i] == arr[j]:
            # repeted.append(arr[j])
            print(arr[i], end = " ")
t=int(input()) #number of test cases
for _ in range(t):
    n=int(input()) # no. of array elements
    l=[int(x) for x in input().split()]  #array elements
    for i in range(1,n-1):
        if l.count(i)==2:  # using count function to count the elements
            print(i,end=' ')
    print()<jupyter_output><empty_output><jupyter_text>**Find the largest palindrome string in a string**<jupyter_code>def LongestPalindrome(s):
    n = len(s)
    # Create a string to store our resultant palindrome
    palindrome = ''
 
    # loop through the input string
    for i in range(n):
 
        # loop backwards through the input string
        for j in range(n, i, -1):
 
            # Break if out of range
            if len(palindrome) >= j-i:
                break
 
            # Update variable if matches
            elif s[i:j] == s[i:j][::-1]:
                palindrome = s[i:j]
                break
 
    return palindrome
string = 'abfgerccdedccfgfer'
LongestPalindrome(string)<jupyter_output><empty_output><jupyter_text>Filter Method in Pyhton<jupyter_code>##function that filters vowels
def filterVowels(letter):
    vowels = ['a', 'e', 'i', 'o', 'u']
    if letter in vowels:
        return True
    else: 
        return False
        
letters = ['a', 'b', 'd', 'e', 'f', 'i', 'j', 'k', 'o']
filetredVowels = filter(filterVowels, letters)
for vowels in filetredVowels:
    print(vowels, end = " ")<jupyter_output>a e i o<jupyter_text>**Find duplicates under given constraints**A sorted array contains 6 different numbers, only 1 number is repeated five times. So there are total 10 numbers in array. Find the duplicate numbers using two comparisons only.**Examples :*** Input: arr[] = {1, 1, 1, 1, 1, 5, 7, 10, 20, 30}    Output: 1* Input: arr[] = {1, 2, 3, 3, 3, 3, 3, 5, 9, 10}    Output: 3* An important observation is, arr[4] or arr[5] is an occurrence of repeated element for sure.<jupyter_code>def findDuplicateIn2Step(arr):
    if arr[3] == arr[4]:
        return arr[3]
    elif arr[4] == arr[5]:
        return arr[4]
    else:
        return arr[5]        
arr = [1, 1, 1, 1, 1, 5, 7, 10, 20, 30]
print(findDuplicateIn2Step(arr))
arr = [1, 2, 3, 3, 3, 3, 3, 5, 9, 10]
print(findDuplicateIn2Step(arr))
# first n prime numbers
num = 50
for n in range(1, num):
    for i in range(2, n):
        if n%i == 0:
            break
    else:
        print(n, end = " ")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14037680088659032, 'fraction_numerical': 0.03140007388252678, 'mean_word_length': 2.7455048409405256, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '596046', 'license': 'MIT', 'n_tokens_mistral': 1037, 'n_tokens_neox': 949, 'n_words': 313, 'path': 'Python_Programs_1.ipynb', 'repo_name': 'msrana172/Big-Data-Engineering-Coursera-Yandex', 'size': '2707'}