loop through set python
#Create a set
num_set = set([0, 1, 2, 3, 4, 5])
for n in num_set:
print(n)
loop through set python
#Create a set
num_set = set([0, 1, 2, 3, 4, 5])
for n in num_set:
print(n)
sets in python
The simplest way to create set is:
1. from list
code:
s = [1,2,3]
set = set(s)
print(set)
2. s,add() method
code:
set.add(1)
set.add(2)
set.remove(2)
print(set) // 1
3. Set conatins unique elements
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us