Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (45.3k points)

I have a set like this:

keep = set(generic_drugs_mapping[drug] for drug in drug_input)

How do I add values [0,1,2,3,4,5,6,7,8,9,10] into this set?

1 Answer

0 votes
by (16.8k points)

First, use : 


Like, keep.update(xrange(11) specifically for your example. In case you want to produce the values in a loop for some other reason, then you can, by using:

for ...whatever...:

  onemorevalue = ...whatever...


Related questions

+3 votes
2 answers
0 votes
1 answer
0 votes
2 answers

Browse Categories