{ "cells": [ { "cell_type": "code", "execution_count": 6, "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": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "第一单元 . 总题数: 1767 , 完成对应题数: 1400\n", "第二单元 . 总题数: 2495 , 完成对应题数: 2127\n", "第三单元 . 总题数: 2079 , 完成对应题数: 395\n", "第四单元 . 总题数: 1127 , 完成对应题数: 1033\n", "第五单元 . 总题数: 1329 , 完成对应题数: 306\n", "第六单元 . 总题数: 1074 , 完成对应题数: 431\n", "第七单元 . 总题数: 1342 , 完成对应题数: 957\n", "第八单元 . 总题数: 1194 , 完成对应题数: 519\n", "第九单元 . 总题数: 277 , 完成对应题数: 101\n" ] } ], "source": [ "for u in range(len(units)):\n", " print(units[u],\". 总题数:\",count1[u],\", 完成对应题数:\",count2[u])\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(12684, 7269)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(sum(count1),sum(count2))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.8.8 ('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.8.8" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "d311ffef239beb3b8f3764271728f3972d7b090c974f8e972fcdeedf230299ac" } } }, "nbformat": 4, "nbformat_minor": 2 }