{ "cells": [ { "cell_type": "code", "execution_count": 1, "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": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "第一单元 . 总题数: 2014 , 完成对应题数: 1400\n", "第二单元 . 总题数: 3111 , 完成对应题数: 2127\n", "第三单元 . 总题数: 2218 , 完成对应题数: 395\n", "第四单元 . 总题数: 1444 , 完成对应题数: 1036\n", "第五单元 . 总题数: 1433 , 完成对应题数: 306\n", "第六单元 . 总题数: 1383 , 完成对应题数: 431\n", "第七单元 . 总题数: 1712 , 完成对应题数: 957\n", "第八单元 . 总题数: 1378 , 完成对应题数: 522\n", "第九单元 . 总题数: 422 , 完成对应题数: 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": "mathdept", "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.15 (main, Nov 24 2022, 14:39:17) [MSC v.1916 64 bit (AMD64)]" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc" } } }, "nbformat": 4, "nbformat_minor": 2 }