except: print 'Image not found: ' + str(reactant[0]) f = open(xml_dir + "miss_react_jme.xml", "a") # print content to xml f.write('<!-- question: 0 -->\n') f.write('<question type=\"category\">\n') f.write('<category>\n') f.write('<text>' + str(courseName) + str(q_type).title() + '</text>') f.write('</category>\n') f.write('</question>\n\n') f.write('<!-- question: 70300 -->\n') f.write('<question type=\"jme\">\n') f.write('<name>\n') f.write('<text>') f.write('JME: ' + tag.remove_tag(str(reagents[0]))) f.write('</text>\n') f.write('</name>\n') f.write('<questiontext format=\"html\">\n') f.write('<text>') f.write( '<![CDATA[<table border=\"0\">' + '<tbody>' + '<tr>' + '<td rowspan=\"3\">' + '<center>' + '<p style=\"font-size:400%;\">?</p>' + '</center></td>' + '<td style=\"vertical-align: bottom; height: 60px;\"><center>' + str(reagents[0]) + '</center></td>' + '<td rowspan=\"3\" style=\"width:60px\"><center>' + '<img src="data:image/png;base64,' + '\n' + str(product_string) + '"/>' + '</center></td>' + '</tr>' + '<tr>' + '<td>' + '<center><b>-------------------------></b></center>' + '</td>' + '</tr>' + '<tr>' +
f = open(xml_dir + "miss_react_text.xml", "a") # print content to xml f.write('<!-- question: 0 -->\n') f.write('<question type=\"category\">\n') f.write('<category>\n') f.write('<text>' + str(courseName) + str(q_type).title() + '</text>\n') f.write('</category>\n') f.write('</question>\n\n') f.write('<!-- question: 70445 -->\n') f.write('<question type=\"multichoice\">\n') f.write('<name>\n') f.write('<text>') f.write('MultiChoice Text: miss_react ' + tag.remove_tag(str(reagents[0]))) f.write('</text>\n') f.write('</name>\n') f.write('<questiontext format=\"html\">\n') f.write('<text>') f.write( '<![CDATA[<table border=\"0\">' + '<tbody>' + '<tr>' + '<td rowspan=\"3\">' + '<center>' + '<p style=\"font-size:200%;\">?</p>' + '</center></td>' + '<td style=\"vertical-align: bottom; height: 60px;\"><center>' + str(reagents[0]) + '</center></td>' + '<td rowspan=\"3\" style=\"width:60px\"><center>' + str(products[0]) + '</center></td>' + '</tr>' + '<tr>' + '<td>' + '<center><b>-------------------------></b></center>' + '</td>' + '</tr>' + '<tr>' + '<td style=\"vertical-align:top; height:60px\">' + '<center>' +
f = open(xml_dir + "miss_reag_text.xml", "a") # print content to xml f.write('<!-- question: 0 -->\n') f.write('<question type=\"category\">\n') f.write('<category>\n') f.write('<text>' + str(courseName) + str(q_type).title() + '</text>\n') f.write('</category>\n') f.write('</question>\n\n') f.write('<!-- question: 70445 -->\n') f.write('<question type=\"multichoice\">\n') f.write('<name>\n') f.write('<text>') f.write('MultiChoice: miss_reag ' + tag.remove_tag(str(reagents[0]))) f.write('</text>\n') f.write('</name>\n') f.write('<questiontext format=\"html\">\n') f.write('<text>') f.write( '<![CDATA[<table border=\"0\">' + '<tbody>' + '<tr>' + '<td rowspan=\"3\">' + '<center>' + str(reactants[0]) + '</center></td>' + '<td style=\"vertical-align: bottom; height: 60px;\"><center>' + '<p style=\"font-size:200%;\">?</p>' + '</center></td>' + '<td rowspan=\"3\" style=\"width:60px\"><center>' + str(products[0]) + '</center></td>' + '</tr>' + '<tr>' + '<td>' + '<center><b>-------------------------></b></center>' + '</td>' + '</tr>' + '<tr>' +
wrong_product_loc = func.random_molecule(prod_size) feedback_wrong_product_loc = 'Incorrect' f = open(xml_dir + "miss_prod_text.xml", "a") # print content to xml f.write('<!-- question: 0 -->\n') f.write('<question type=\"category\">\n') f.write('<category>\n') f.write('<text>' + str(courseName) + str(q_type).title() + '</text>\n') f.write('</category>\n') f.write('</question>\n\n') f.write('<!-- question: 70445 -->\n') f.write('<question type=\"multichoice\">\n') f.write('<name>\n') f.write('<text>') f.write('MultiChoice Text: miss_prod ' + tag.remove_tag(str(reagents[0]))) f.write('</text>\n') f.write('</name>\n') f.write('<questiontext format=\"html\">\n') f.write('<text>') f.write('<![CDATA[<table border=\"0\">' + '<tbody>' + '<tr>' + '<td rowspan=\"3\">' +'<center>' + str(reactants[0]) + '</center></td>' + '<td style=\"vertical-align: bottom; height: 60px;\"><center>' + str(reagents[0]) + '</center></td>' + '<td rowspan=\"3\" style=\"width:60px\"><center>' + '<p style=\"font-size:200%;\">?</p>' + '</center></td>' + '</tr>' + '<tr>' + '<td>' + '<center><b>-------------------------></b></center>' + '</td>' + '</tr>' + '<tr>' + '<td style=\"vertical-align:top; height:60px\">' + '<center>' + str(reagents[3]) + '</center>' + '</td>' + '</tr>' + '</tbody>' + "</table><br><br>]]>\n") f.write('</text>\n') f.write('</questiontext>\n') f.write('<generalfeedback format=\"html\">\n')