Question: SENG 265 A01/A02 Page 8 Section B: Python (Total marks: 70) Question 21 (20 marks): Consider the following Python code, named mystery.py (line numbers provided
SENG 265 A01/A02 Page 8 Section B: Python (Total marks: 70) Question 21 (20 marks): Consider the following Python code, named "mystery.py" (line numbers provided for your reference) 1 #1/usr/bin/Python3 3 import sys 5 def mainO: aaa = [] for bbb in sys.stdin: 6 ccc = bbb.spl ito aaa.extend (ccc) 9 10 11 ddd-[len(zzz) for zzz. in aaa] ddd. sortO eee=ddd[0] for ggg in ddd[12]: 12 13 14 15 fff 1 16 17 if eee ! 99g: 18 print Ceee,:"fff) 19 20 21 else: 23 24 print (eee, ";", fff) 25 26 if name 27 mainO and the following input, named "in01.txt": Do you 1ike green eggs and ham? I do not like them Sam I am I do not 1ike green eggs and ham Write on the lines below the output that results when the input is redirected into the Python program (ie, "cat in01.txt | -/mystery.py"). Assume the fle permissions for mystery.py are correct and the Python interpreter is located as shownt in the bang path. You may use page 9 for your rough work
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
