<jupyter_start><jupyter_text>Question 1Create a function that takes a list of non-negative integers and strings and return a new list without the strings.Examplesfilter_list([1, 2, "a", "b"]) ➞ [1, 2]filter_list([1, "a", "b", 0, 15]) ➞ [1, 0, 15]filter_list([1, 2, "aasf", "1", "123", 123]) ➞ [1, 2, 123]<jupyter_code>l = [1, 2, "a", "b"]
def filter_list():
  l1 = []
  for i in l :
    if type(i) == int:
      l1.append(i)
  return  l1
filter_list()<jupyter_output><empty_output><jupyter_text>Question 2The "Reverser" takes a string as input and returns that string in reverse order, with the opposite case.Examplesreverse("Hello World") ➞ "DLROw OLLEh"reverse("ReVeRsE") ➞ "eSrEvEr"reverse("Radar") ➞ "RADAr"<jupyter_code>def reverse(string):
  return(string[::-1].swapcase())
reverse("ReVeRsE")<jupyter_output><empty_output><jupyter_text>Question 3You can assign variables from lists like this:lst = [1, 2, 3, 4, 5, 6]first = lst[0]middle = lst[1:-1]last = lst[-1]print(first) ➞ outputs 1print(middle) ➞ outputs [2, 3, 4, 5]print(last) ➞ outputs 6With Python 3, you can assign variables from lists in a much more succinct way. Create variables first, middle and last from the given list using destructuring assignment (check the Resources tab for some examples), where:first  ➞ 1middle ➞ [2, 3, 4, 5]last ➞ 6Your task is to unpack the list writeyourcodehere into three variables, being first, middle, and last, with middle being everything in between the first and last element. Then print all three variables.<jupyter_code>lst = [1, 2, 3, 4, 5, 6]
first ,*middle,last = lst
first
first
middle
last<jupyter_output><empty_output><jupyter_text>Question 4Write a function that calculates the factorial of a number recursively.Examplesfactorial(5) ➞ 120factorial(3) ➞ 6factorial(1) ➞ 1factorial(0) ➞ 1<jupyter_code>def factorial(no):
  if no == 1 or no ==1:
    return 1
  else:
    return (no * factorial(no-1))
factorial(5)<jupyter_output><empty_output><jupyter_text>Question 5Write a function that moves all elements of one type to the end of the list.Examplesmove_to_end([1, 3, 2, 4, 4, 1], 1) ➞ [3, 2, 4, 4, 1, 1]move_to_end([7, 8, 9, 1, 2, 3, 4], 9) ➞ [7, 8, 1, 2, 3, 4, 9]move_to_end(["a", "a", "a", "b"], "a") ➞ ["b", "a", "a", "a"]<jupyter_code>def move_to_end(array, toMove):
     
    i = 0
 
    # Mark the right pointer
    j = len(array) - 1
  
    # Iterate untill left pointer
    # crosses the right pointer
    while (i < j):
  
        while (i < j and array[j] == toMove):
  
            # decrement right pointer
            j-=1
  
        if (array[i] == toMove):
  
            # swap the two elements
            # in the array
            array[i], array[j] = array[j] , array[i]
  
        # increment left pointer
        i += 1
  
    # return the result
    return array
arr = [7, 8, 9, 1, 2, 3, 4]
k = 9
ans = move_to_end(arr, k)
for i in range(len(arr)):
    print(ans[i] ,end= " ")<jupyter_output>7 8 4 1 2 3 9
{'fraction_non_alphanumeric': 0.13931362555215765, 'fraction_numerical': 0.043493034318722396, 'mean_word_length': 3.779220779220779, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 20, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '136912', 'license': 'MIT', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1089, 'n_words': 376, 'path': 'Programming_Assingment_18.ipynb', 'repo_name': 'Shanu2092/Python-Basic-Programming-Assignment', 'size': '2943'}