{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import json,os\n", "with open(r\"..\\题库0.3\\problems.json\",\"r\",encoding = \"u8\") as f:\n", " database = f.read()\n", "pro_dict = json.loads(database)\n", "units = [\"第一单元\",\"第二单元\",\"第三单元\",\"第四单元\",\"第五单元\",\"第六单元\",\"第七单元\",\"第八单元\",\"第九单元\"]\n", "count1 = [0]*9\n", "count2 = [0]*9\n", "for id in pro_dict:\n", " for u in range(9):\n", " unit = units[u]\n", " if unit in \"\".join(pro_dict[id][\"tags\"]):\n", " count1[u] += 1\n", " if len(pro_dict[id][\"objs\"]) > 0:\n", " count2[u] += 1" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "第一单元 . 总题数: 1411 , 完成对应题数: 1397\n", "第二单元 . 总题数: 1987 , 完成对应题数: 1985\n", "第三单元 . 总题数: 1946 , 完成对应题数: 390\n", "第四单元 . 总题数: 1023 , 完成对应题数: 594\n", "第五单元 . 总题数: 1236 , 完成对应题数: 301\n", "第六单元 . 总题数: 882 , 完成对应题数: 254\n", "第七单元 . 总题数: 1219 , 完成对应题数: 59\n", "第八单元 . 总题数: 1122 , 完成对应题数: 169\n", "第九单元 . 总题数: 156 , 完成对应题数: 23\n" ] } ], "source": [ "for u in range(len(units)):\n", " print(units[u],\". 总题数:\",count1[u],\", 完成对应题数:\",count2[u])\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.7 ('base')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "e4cce46d6be9934fbd27f9ca0432556941ea5bdf741d4f4d64c6cd7f8dfa8fba" } } }, "nbformat": 4, "nbformat_minor": 2 }