• Python question of the day

    What would be the output of executing the following code:
    vowel_set = {'a', 'e', 'i','o', 'u'}
    all_vowels_set = vowel_set.add('A')
    print(all_vowels_set)
     {a', 'e', 'i', 'o', 'u', 'A'}
     {'A', 'a', 'e', 'i', 'o', 'u'}
     None
     TypeError
    Explanation:
    In python, The set add() method adds a given element to a set, if the element is not already present. If the element is already present, it doesn't add any element and does NOT raise any error. The method returns None


    Top 100 python interview questions:


  • python bootcamp 2021
datai analytics