Code:
print(set())
print(set('Python'))
print(set(('a','e','i','o','u')))
print(set(['a','e','i','o','u']))
print(set(range(5)))
print(set({'a','e','i','o','u'}))
print(set({'a':1,'e':2,'i':3,'o':4,'u':5}))
frozen_set=frozenset(('a','e','i','o','u'))
print(set(frozen_set))
class PrintNumber:
def __init__(self,max):
self.max=max
def __iter__(self):
self.num=0
return self
def __next__(self):
if(self.num(put_greater_than_sign_here)=self.max):
raise StopIteration
self.num+=1
return self.num
print_num=PrintNumber(5)
print(set(print_num))
#setattr
class Person:
name='Anant'
p=Person()
print(p.name)
setattr(p, 'name', 'Akash')
print(p.name)
class Person:
name='Anant'
p=Person()
setattr(p,'name','Akash')
print(p.name)
setattr(p,'age',22)
print(p.age)
On this page of the site you can watch the video online 189. Set and Setattr Function in Python with Example Code || Attribute Python Built-in Functions-26 with a duration of hours minute second in good quality, which was uploaded by the user Bhavatavi 27 October 2022, share the link with friends and acquaintances, this video has already been watched 5 times on youtube and it was liked by 0 viewers. Enjoy your viewing!