## combine values

0 likes • Nov 19, 2022
Python

## More Python Posts

```# Python code to demonstrate# method to remove i'th character# Naive Method
# Initializing Stringtest_str = "CodeCatch"
# Printing original stringprint ("The original string is : " + test_str)
# Removing char at pos 3# using loopnew_str = ""
for i in range(len(test_str)):	if i != 2:		new_str = new_str + test_str[i]
# Printing string after removalprint ("The string after removal of i'th character : " + new_str)```
```import pandas as pd

print(x)```

### Size of tuple

CodeCatch
0 likes • Nov 19, 2022
Python
```import sys
# sample TuplesTuple1 = ("A", 1, "B", 2, "C", 3)Tuple2 = ("Geek1", "Raju", "Geek2", "Nikhil", "Geek3", "Deepanshu")Tuple3 = ((1, "Lion"), ( 2, "Tiger"), (3, "Fox"), (4, "Wolf"))
# print the sizes of sample Tuplesprint("Size of Tuple1: " + str(sys.getsizeof(Tuple1)) + "bytes")print("Size of Tuple2: " + str(sys.getsizeof(Tuple2)) + "bytes")print("Size of Tuple3: " + str(sys.getsizeof(Tuple3)) + "bytes")```
```prime_lists=[] # a list to store the prime numbers
def prime(n): # define prime numbers    if n <= 1:        return False    # divide n by 2... up to n-1    for i in range(2, n):        if n % i == 0:  # the remainder should'nt be a 0            return False    else:        prime_lists.append(n)        return True

for n in range(30,1000):  # calling function and passing starting point =30 coz we need primes >30    prime(n)
check=0 # a var to limit the output  to 10 onlyfor n in prime_lists:    for x in prime_lists:        val=  n *x        if (val > 1000 ):            check=check +1        if (check <10) :            print("the num is:", val , "=",n , "* ", x )        break```
```import string
def caesar(text, shift, alphabets):	def shift_alphabet(alphabet):	    return alphabet[shift:] + alphabet[:shift]		shifted_alphabets = tuple(map(shift_alphabet, alphabets))	final_alphabet = "".join(alphabets)	final_shifted_alphabet = "".join(shifted_alphabets)	table = str.maketrans(final_alphabet, final_shifted_alphabet)	return text.translate(table)
plain_text = "Hey Skrome, welcome to CodeCatch"print(caesar(plain_text, 8, [string.ascii_lowercase, string.ascii_uppercase, string.punctuation]))```
`import copybegining = [False,False,False,False,False,None,True,True,True,True,True]#False = black True = whiteits = def swap(layout, step):    layoutCopy = copy.deepcopy(layout)    layoutCopy[(step+step)], layoutCopy[step] = layoutCopy[step], layoutCopy[(step+step)]    return layoutCopydef isSolved(layout):    for i in range(len(layout)):        if(layout[i] == False):            return (i >= (len(layout)/2))def recurse(layout, its, steps = []):    if isSolved(layout):        its += 1        print(layout,list(x for x in steps))        return    step = None    for i in range(len(layout)):        if(layout[i] == None):            if(i >= 1): #If the empty space could have something to the left                if(layout[i - 1] == False):                    step = [-1,i]                    recurse(swap(layout,step), its, (steps+[step]))                if(i > 1): #If the empty space could have something 2 to the left                    if(layout[i - 2] == False):                        step = [-2,i]                        recurse(swap(layout,step), its, (steps+[step]))            if(i < (len(layout)-1)): #If the empty space could have something to the right                if(layout[i + 1] == True):                    step = [1,i]                    recurse(swap(layout,step), its, (steps+[step]))                if(i < (len(layout)-2)): #If the empty space could have something to the right                    if(layout[i + 2] == True):                        step = [2,i]                        recurse(swap(layout,step), its, (steps+[step]))    its += 1    #return Nonerecurse(begining,its,[])print(its)`