错题库()()

这个错的
void StringCount( char s[] )
{
    int l=0,b=0,d=0,o=0;
    for(int i=0;s[i]!='\0';i++)
    {
        if(('A'<=s[i]&&s[i]<='Z')||('a'<=s[i]&&s[i]<='z'))
        {
            l++;
        }
        else if('0'<=s[i]&&s[i]<='9')
        {
            d++;
        }
        else if(s[i]=='\n'||s[i]==' ')
        {
            d++;
        }
        else
        {
            o++;
        }
    }
    printf("letter = %d, blank = %d, digit = %d, other = %d ",l,b,d,o);
}
#include<stdio.h>
int main()
{
    char s[50],a,b,*p; //程序要实现用字符变量b替换字符串s中的字符变量a
    gets(s);
    scanf("%c %c",&a,&b);
    for(p=s;*p;p++)
        if(*p==a)
            *p=b;
    puts(s);
    return 0;
}

 

#include<stdio.h>

int main()
{
    char str[10000];
    int a[100] = {0}; // 初始化数组
    fgets(str, sizeof(str), stdin);

    for(int i=0; str[i] != 0; i++)
    {
        int x = str[i]-'0';
        a[x]++;
    }

    for(int i=0; i<10; i++)
    {
        if(a[i]!=0)
            printf("%d:%d\n",i,a[i]);
    }
    return 0;
}

虽然给定引用中未直接提及使用 Python 整理题库的方法,但可以结合相关信息提供思路。 ### 数据收集与准备 首先,需要将题数据收集起来。若题数据从网页获取,可使用爬虫技术获取,如示例中提到根据响应数据的结构,使用 Python 的字典、列表等数据结构操作方法提取出所需的题目、选项、答案等信息。假设响应数据是包含多个题目的列表,每个题目是一个字典,包含 `question`(题目)、`options`(选项)、`answer`(答案)等键,以下是提取题目信息的示例代码: ```python # 假设这是从网页获取的响应数据 response_data = [ { "question": "这是一道题目", "options": ["选项A", "选项B", "选项C"], "answer": "A" }, { "question": "这是另一道题目", "options": ["选项D", "选项E", "选项F"], "answer": "D" } ] # 提取题目信息 questions = [] for item in response_data: question = { "question": item["question"], "options": item["options"], "answer": item["answer"] } questions.append(question) print(questions) ``` ### 数据存储 将收集到的题数据存储到文件中,如 CSV 文件。以下是将上述 `questions` 列表存储到 CSV 文件的示例代码: ```python import csv # 定义 CSV 文件的列名 fieldnames = ['question', 'options', 'answer'] # 打开 CSV 文件进行写入 with open('wrong_questions.csv', mode='w', newline='', encoding='utf-8') as file: writer = csv.DictWriter(file, fieldnames=fieldnames) # 写入列名 writer.writeheader() # 写入题数据 for question in questions: writer.writerow(question) ``` ### 数据整理与分析 可以对存储的题数据进行整理和分析,例如去重。使用 Python 的 `set` 特性去除重复的题: ```python # 假设从 CSV 文件读取题数据到一个列表中 import csv wrong_questions = [] with open('wrong_questions.csv', mode='r', encoding='utf-8') as file: reader = csv.DictReader(file) for row in reader: wrong_questions.append(row) # 去重 unique_questions = [] question_set = set() for question in wrong_questions: question_str = str(question) if question_str not in question_set: question_set.add(question_str) unique_questions.append(question) print(unique_questions) ``` ### 题分类 可以根据题的知识点、难度等信息对题进行分类。以下是一个简单的示例,假设题数据中有 `knowledge_point` 字段表示知识点: ```python # 假设 unique_questions 是去重后的题列表 knowledge_point_dict = {} for question in unique_questions: knowledge_point = question.get('knowledge_point', '未知知识点') if knowledge_point not in knowledge_point_dict: knowledge_point_dict[knowledge_point] = [] knowledge_point_dict[knowledge_point].append(question) # 打印每个知识点下的题 for knowledge_point, questions in knowledge_point_dict.items(): print(f"{knowledge_point} 下的题:") for question in questions: print(question) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值