Question 5 double-hero \"\" Supe \'superman\' bat = \'batman\' for letter in bat
ID: 3607703 • Letter: Q
Question
Question 5 double-hero "" Supe 'superman' bat = 'batman' for letter in bat if letter not in supe: break else double_hero.append(letter) continue print (double_hero) a) aman b) the empty string c) b d) bt e) none of the above Question 6 candidates = {'dens ' :2, print (candidates[2]) 'reps ':3, 'out' :15) a) t b) dems c) out d) dems: 2 e) none of the above Question 7 def dictTest (d, aVal): for k in d: if d [k] == aval: return k return None lengths = {' one' :3, :1, 'two' :3} print (dictTest(lengths, 3)) a) KeyError: 3 b) None c) one d) ['one', 'two'] e) none of the aboveExplanation / Answer
5. b) the empty string
this is because it will test for b in first iteration of loop, as is it not there in supe, break; statement will be executed, and hence empty string will be printed.
6. a) empty
It is because in candidates[2] , 2 is the key of candidate set, but keys available in candidates are dems,reps and out only, So there is no matching key available.
7.c) one
We are searching here for key whose value is 3 , so output is one
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.