Check 5.1
From just what you know now, can you think of a problem from one of the previous homework assignments where 2D lists might have been helpful? If so, write it in the editor below, and explain in a sentence or two how you might have used them. If not, describe another application, problem, or game in a sentence or two where 2D lists might be handy.
import sys
def set_certificate(certificate_div_id, certificate):
document[certificate_div_id].textContent = certificate
def get_student_code(student_code_div_id):
raw_student_code = document[student_code_div_id].textContent
return window.patchCodeToCheckTimeout(raw_student_code, 'check_timeout();');
class captureIO:
def __init__(self):
self.captured = []
def get_output(self):
out = ""
for c in self.captured:
out += str(c)
return out
def write(self, data):
self.captured.append(data)
def flush(self):
pass
def is_mvc_def(answer):
if len(answer) > 40: return "Satisfactory"
return "NEC"
def make_certificate(student_code_div_id, certificate_div_id):
student_code = get_student_code(student_code_div_id)
certificate = []
try:
output = is_mvc_def(student_code)
certificate.append((output, type(output)))
except:
set_certificate(certificate_div_id, "error")
set_certificate(certificate_div_id, str(certificate))