<jupyter_start><jupyter_text>Question 1:<jupyter_code>Create a function that takes three integer arguments (a, b, c) and returns the amount of
integers which are of equal value.

Examples

equal(3, 4, 3) ➞ 2
equal(1, 1, 1) ➞ 3
equal(3, 4, 1) ➞ 0

Notes
Your function must return 0, 2 or 3.<jupyter_output><empty_output><jupyter_text>Answer :<jupyter_code>def equal(a,b,c):
    length = len(set((a,b,c)))
    if length == 1:
        return 3
    elif length == 3:
        return 0
    else:
        return 2
    
print(equal(3, 4, 3))
print(equal(1, 1, 1))
print(equal(3, 4, 1))<jupyter_output>2
3
0<jupyter_text>Question 2:<jupyter_code>write a function that converts a dictionary into a list of keys-values tuples.

Examples

dict_to_list({
 "D": 1,
 "B": 2,
 "C": 3
}) ➞ [("B", 2), ("C", 3), ("D", 1)]

dict_to_list({
 "likes": 2,
 "dislikes": 3,
 "followers": 10
}) ➞ [("dislikes", 3), ("followers", 10), ("likes", 2)]

Notes
Return the elements in the list in alphabetical order.<jupyter_output><empty_output><jupyter_text>Answer :<jupyter_code>def dict_to_list(dic):
    return sorted(dic.items())

print(dict_to_list({
 "D": 1,
 "B": 2,
 "C": 3
}))
print(dict_to_list({
 "likes": 2,
 "dislikes": 3,
 "followers": 10
}))<jupyter_output>[('B', 2), ('C', 3), ('D', 1)]
[('dislikes', 3), ('followers', 10), ('likes', 2)]<jupyter_text>Question 3:<jupyter_code>Write a function that creates a dictionary with each (key, value) pair being the (lower case,
upper case) versions of a letter, respectively.
Examples
mapping(["p", "s"]) ➞ { "p": "P", "s": "S" }
mapping(["a", "b", "c"]) ➞ { "a": "A", "b": "B", "c": "C" }
mapping(["a", "v", "y", "z"]) ➞ { "a": "A", "v": "V", "y": "Y", "z": "Z" }Notes
All of the letters in the input list will always be lowercase.<jupyter_output><empty_output><jupyter_text>Answer :<jupyter_code>def mapping(lst):
    dic = {}
    for i in lst:
        dic[i] = i.upper()
    return dic

print(mapping(["p", "s"]))
print(mapping(["a", "b", "c"]))
print(mapping(["a", "v", "y", "z"]))<jupyter_output>{'p': 'P', 's': 'S'}
{'a': 'A', 'b': 'B', 'c': 'C'}
{'a': 'A', 'v': 'V', 'y': 'Y', 'z': 'Z'}<jupyter_text>Question 4:<jupyter_code>Write a function, that replaces all vowels in a string with a specified vowel.

Examples

vow_replace("apples and bananas", "u") ➞ "upplus und bununus"
vow_replace("cheese casserole", "o") ➞ "chooso cossorolo"
vow_replace("stuffed jalapeno poppers", "e") ➞ "steffed jelepene peppers"

Notes
All words will be lowercase. Y is not considered a vowel.<jupyter_output><empty_output><jupyter_text>Answer :<jupyter_code>def vow_replace(string, char):
    test = ""
    vowel = "aeiou"
    for i in string:
        if i in vowel:
            test += char
        else:
            test += i
    return test


print(vow_replace("apples and bananas", "u"))
print(vow_replace("cheese casserole", "o"))
print(vow_replace("stuffed jalapeno poppers", "e"))<jupyter_output>upplus und bununus
chooso cossorolo
steffed jelepene peppers<jupyter_text>Question 5:<jupyter_code>Create a function that takes a string as input and capitalizes a letter if its ASCII code is even
and returns its lower case version if its ASCII code is odd.
Examples
ascii_capitalize("to be or not to be!") ➞ "To Be oR NoT To Be!"
ascii_capitalize("THE LITTLE MERMAID") ➞ "THe LiTTLe meRmaiD"
ascii_capitalize("Oh what a beautiful morning.") ➞ "oH wHaT a BeauTiFuL moRNiNg."<jupyter_output><empty_output><jupyter_text>Answer<jupyter_code>def ascii_capitalize(string):
    test = ""
    for i in string:
        if i.isalpha():
            if ord(i)%2 == 0:
                test += i.upper()
            else:
                test += i.lower()
        else:
            test += i
    return test

print(ascii_capitalize("to be or not to be!"))
print(ascii_capitalize("THE LITTLE MERMAID"))
print(ascii_capitalize("Oh what a beautiful morning."))<jupyter_output>To Be oR NoT To Be!
THe LiTTLe meRmaiD
oH wHaT a BeauTiFuL moRNiNg.
{'fraction_non_alphanumeric': 0.16958174904942966, 'fraction_numerical': 0.016983523447401776, 'mean_word_length': 4.23342175066313, 'pattern_counts': {'":': 21, '<': 36, '<?xml version=': 0, '>': 36, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '537674', 'license': 'MIT', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1549, 'n_words': 461, 'path': 'Python Programming Basic Assignment/Assignment_25.ipynb', 'repo_name': 'kpsanjeet/Python-Programming-Basic-Assignment', 'size': '3945'}