<jupyter_start><jupyter_text>**Question1**Write a function that takes a list and a number as arguments. Add the number to the end ofthe list, then remove the first element of the list. The function should then return the updatedlist.**Examples**next_in_line([5, 6, 7, 8, 9], 1) ➞ [6, 7, 8, 9, 1]next_in_line([7, 6, 3, 23, 17], 10) ➞ [6, 3, 23, 17, 10]next_in_line([1, 10, 20, 42 ], 6) ➞ [10, 20, 42, 6]next_in_line([], 6) ➞ "No list has been selected" **Answer:**<jupyter_code>def next_in_line(x_list, x):
    if len(x_list) == 0:
        return "No list has been selected"
    else:
        new_list = x_list[1:]
        new_list.append(x)
        return new_list

for x_list, x in [([5, 6, 7, 8, 9], 1), ([7, 6, 3, 23, 17], 10), ([1, 10, 20, 42 ], 6), ([], 6)]:
    print(next_in_line(x_list, x))<jupyter_output>[6, 7, 8, 9, 1]
[6, 3, 23, 17, 10]
[10, 20, 42, 6]
No list has been selected<jupyter_text>**Question2**Create the function that takes a list of dictionaries and returns the sum of people&39;s budgets.**Examples**get_budgets([{ "name": "John", "age": 21, "budget": 23000 },{ "name": "Steve", "age": 32, "budget": 40000 },{ "name": "Martin", "age": 16, "budget": 2700 }]) ➞ 65700get_budgets([{ "name": "John", "age": 21, "budget": 29000 },{ "name": "Steve", "age": 32, "budget": 32000 },{ "name": "Martin", "age": 16, "budget": 1600 }]) ➞ 62600 **Answer:**<jupyter_code>def get_budgets(x):
    budget_list = [i['budget'] for i in x]
    total_budget = sum(budget_list)
    return total_budget

list1 = [
    { "name": "John", "age": 21, "budget": 23000 },
    { "name": "Steve", "age": 32, "budget": 40000 },
    { "name": "Martin", "age": 16, "budget": 2700 }
]

list2 = [
    { "name": "John", "age": 21, "budget": 29000 },
    { "name": "Steve", "age": 32, "budget": 32000 },
    { "name": "Martin", "age": 16, "budget": 1600 }
]

for x in [list1, list2]:
    print(get_budgets(x))<jupyter_output>65700
62600<jupyter_text>**Question3**Create a function that takes a string and returns a string with its letters in alphabetical order.**Examples**alphabet_soup("hello") ➞ "ehllo"alphabet_soup("edabit") ➞ "abdeit"alphabet_soup("hacker") ➞ "acehkr"alphabet_soup("geek") ➞ "eegk"alphabet_soup("javascript") ➞ "aacijprstv" **Answer:**<jupyter_code>def alphabet_soup(x):
    temp_list = sorted(list(x))
    return ''.join(temp_list)

for x in ["hello", "edabit", "hacker", "geek", "javascript"]:
    print(alphabet_soup(x))<jupyter_output>ehllo
abdeit
acehkr
eegk
aacijprstv<jupyter_text>**Question4**Suppose that you invest $10,000 for 10 years at an interest rate of 6% compounded monthly.What will be the value of your investment at the end of the 10 year period?Create a function that accepts the principal p, the term in years t, the interest rate r, and thenumber of compounding periods per year n. The function returns the value at the end of termrounded to the nearest cent.For the example above:compound_interest(10000, 10, 0.06, 12) ➞ 18193.97Note that the interest rate is given as a decimal and n=12 because with monthly compoundingthere are 12 periods per year. Compounding can also be done annually, quarterly, weekly, ordaily.**Examples**compound_interest(100, 1, 0.05, 1) ➞ 105.0compound_interest(3500, 15, 0.1, 4) ➞ 15399.26compound_interest(100000, 20, 0.15, 365) ➞ 2007316.26 **Answer:**<jupyter_code>def compound_interest(p, t, r, n):
    compound_factor = (1 + r / n) ** (t * n)
    fv = p * compound_factor
    return round(fv, 2)

for p, t, r, n in [(100, 1, 0.05, 1), (3500, 15, 0.1, 4), (100000, 20, 0.15, 365)]:
    print(compound_interest(p, t, r, n))<jupyter_output>105.0
15399.26
2007316.26<jupyter_text>**Question5**Write a function that takes a list of elements and returns only the integers.**Examples**return_only_integer([9, 2, "space", "car", "lion", 16]) ➞ [9, 2, 16]return_only_integer(["hello", 81, "basketball", 123, "fox"]) ➞ [81, 123]return_only_integer([10, "121", 56, 20, "car", 3, "lion"]) ➞ [10, 56, 20,3]return_only_integer(["String", True, 3.3, 1]) ➞ [1] **Answer:**<jupyter_code>def return_only_integer(x):
    new_list = [i for i in x if isinstance(i, int) and not isinstance(i, bool)]
    return new_list

for x in [[9, 2, "space", "car", "lion", 16], 
          ["hello", 81, "basketball", 123, "fox"], 
          [10, "121", 56, 20, "car", 3, "lion"],
          ["String", True, 3.3, 1]]:
    print(return_only_integer(x))<jupyter_output>[9, 2, 16]
[81, 123]
[10, 56, 20, 3]
[1]
{'fraction_non_alphanumeric': 0.17909439062851995, 'fraction_numerical': 0.0937148006307727, 'mean_word_length': 4.6923076923076925, 'pattern_counts': {'":': 36, '<': 16, '<?xml version=': 0, '>': 16, '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': '140336', 'license': 'MIT', 'n_tokens_mistral': 2082, 'n_tokens_neox': 1696, 'n_words': 547, 'path': 'Python Programming Basic Assignment - Assignment21.ipynb', 'repo_name': 'VaheC/Python_assigments', 'size': '4439'}