<jupyter_start><jupyter_text>Question 1:<jupyter_code>Create a function that takes a list of non-negative integers and strings and return a new list
without the strings.
Examples
filter_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_output><empty_output><jupyter_text>def filter_list(lst):    return list(filter(lambda x: type(x) == int,lst))print(filter_list([1, 2, "a", "b"]))print(filter_list([1, "a", "b", 0, 15]))print(filter_list([1, 2, "aasf", "1", "123", 123]))<jupyter_code>Question 2:<jupyter_output><empty_output><jupyter_text>The "Reverser" takes a string as input and returns that string in reverse order, with theopposite case.Examplesreverse("Hello World") ➞ "DLROw OLLEh"reverse("ReVeRsE") ➞ "eSrEvEr"reverse("Radar") ➞ "RADAr"<jupyter_code>Answer :<jupyter_output><empty_output><jupyter_text>def reverse(string):    return string[::-1].swapcase()print(reverse("Hello World"))print(reverse("ReVeRsE"))print(reverse("Radar"))<jupyter_code>Question 3:<jupyter_output><empty_output><jupyter_text>You 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. Createvariables 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. Thenprint all three variables.<jupyter_code>Answer :<jupyter_output><empty_output><jupyter_text>def unpack_list(lst):    first = lst[0]    middle = lst[1:-1]    last = lst[-1]    return first,middle,lastlst = [1, 2, 3, 4, 5, 6]first,middle,last = unpack_list(lst)print(first)print(middle)print(last)<jupyter_code>Question 4:<jupyter_output><empty_output><jupyter_text>Write a function that calculates the factorial of a number recursively. Examplesfactorial(5) ➞ 120factorial(3) ➞ 6factorial(1) ➞ 1factorial(0) ➞ 1<jupyter_code>def factorial(num):
    if num<0:
        return f"{num} is negative number."
    if num == 0 or num == 1:
        return 1
    else: 
        return num*factorial(num-1)
    
    
    
print(factorial(5))
print(factorial(3))
print(factorial(1))
print(factorial(0))<jupyter_output>120
6
1
1<jupyter_text>Question 5:<jupyter_code>Write a function that moves all elements of one type to the end of the list.
Examples
move_to_end([1, 3, 2, 4, 4, 1], 1) ➞ [3, 2, 4, 4, 1, 1]
# Move all the 1s to the end of the array.
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_output><empty_output><jupyter_text>Answer :<jupyter_code>def move_to_end(lst,x):
    lst.remove(x)
    lst.append(x)
    return lst

print(move_to_end([1, 3, 2, 4, 4, 1], 1))
print(move_to_end([7, 8, 9, 1, 2, 3, 4], 9))
print(move_to_end(["a", "a", "a", "b"], "a"))<jupyter_output>[3, 2, 4, 4, 1, 1]
[7, 8, 1, 2, 3, 4, 9]
['a', 'a', 'b', 'a']
{'fraction_non_alphanumeric': 0.16605166051660517, 'fraction_numerical': 0.04981549815498155, 'mean_word_length': 5.721074380165289, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 35, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '962', 'license': 'MIT', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1277, 'n_words': 369, 'path': 'Python Programming Basic Assignment/Assignment_18.ipynb', 'repo_name': 'kpsanjeet/Python-Programming-Basic-Assignment', 'size': '3252'}