You loop through a list of coupon codes. Skip the expired co…
You loop through a list of coupon codes. Skip the expired code “DISC0” and stop processing once you hit the “FINAL” flag.How many codes are printed by this loop? python CopyEdit codes = [‘DISC10’, ‘DISC0’, ‘DISC20’, ‘FINAL’, ‘DISC30’] for code in codes: if code == ‘DISC0’: continue if code == ‘FINAL’: break print(code) Answer: 2 Explanation: “DISC10” is printed “DISC0” is skipped due to continue “DISC20” is printed “FINAL” triggers the break, stopping before printing “DISC30” is never reached
Read Details