Answer:
Follows are the code to this question:
def allEqual(l):#defining a method allEqual that accepts a parameter
if len(l)==0:#defining if block that check list length equal to 0
return True#return true value
x=set(l) #defining x variable that set of given list
if len(x)!=1: #defining if that check x is not equal to 1
return False#return False
return True#return True
print(allEqual([]))#Use print method to call method and print value
print(allEqual(["aa"]))#Use print method to call method and print value
print(allEqual(["aa", "aa", "aa"]))#Use print method to call method and print value
print(allEqual(["aa", "aa", "ab"]))#Use print method to call method and print value
print(allEqual([1,1,3, 1]))#Use print method to call method and print value
Output:
True
True
True
False
False
Explanation:
In the above-given code a method "allEqual" is defined that accept and a list in its parameter and inside the method a conditional statement is used that can be defined as follows:
In if block, it checks the length of the list which is equal to 0, it will return 0.
In the next step, an "x" variable is declared, that uses the set method to hold list value and use if block to check length not equal to 1 and return false, or method returns a value that is equal to true.