I wants to return a list as frozenset type and its type will be checked by returning function as given below
frozentSet = functionName(list1, list2)
if type(frozentSet) == frozenset:
print("Return value is a frozenset")
else:
print("Retrun value is not a frozenset")
Whenever I am returning any list as "frozenset" it gives the result as below, while I wants to return as given in above if condition.
return frozenset(['a','b','c','d','e','f'])
Output:
['f']
['b']
['a']
['d']
['e']
Returned value is not a frozenset
Thanks for your prompt response. Please see the whole code below.
def returnFrozenset(listA):
frsA = frozenset(listA)
return frsA
if __name__ == '__main__':
lst1_count = int(input().strip())
lst1 = []
for _ in range(lst1_count):
lst1_item = input()
lst1.append(lst1_item)
isFrozenSet = returnFrozenset(lst1)
print("Returned value is {1} frozenset".format(isFrozenSet, "a" if type(frset) == frozenset else "not a"))
Maybe with a little more code we can help you out, I'm doing the same as you and everything is working fine.
Example code:
output: