Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started