Question: Remove the smallest element from the set, s. If the set is empty, it remains empty. s = set([2, 3, 1, 200, 12]) print(s) small

Remove the smallest element from the set, s. If the set is empty, it remains empty.

s = set([2, 3, 1, 200, 12]) print(s) small = 0 for i in s: if(i < small): s.remove(s) print(s) My output for s is what I have in the set the first time, but the second time, I need it printed without the smallest of those numbers (1). What am I doing wrong? I am using PyCharm Professional utilizing Python 3.6 x64. Output One: 1, 2, 3, 200, 12 Output Two: 1, 2, 3, 200, 12 Output Two should be: 2, 3, 200, 12 Please advise.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!