书生大模型实战营第三期——入门岛——python基础知识

第二关:python基础知识

任务如下:

任务描述
闯关任务 Python实现wordcount
闯关任务 Vscode连接InternStudio debug笔记

1 Vscode连接InternStudio

见第一关教程中vscode远程连接部分。

书生大模型实战营第三期------入门岛------Linux基础知识-CSDN博客

2 Python实现wordcount

python 复制代码
def word_count(text):
    import re
    words = re.findall(r'\b\w+\b', text.lower())
    word_dict = {}
    for word in words:
        if word in word_dict:
            word_dict[word] += 1
        else:
            word_dict[word] = 1
    return word_dict

input_text = """Got this panda plush toy for my daughter's birthday,
who loves it and takes it everywhere. It's soft and
super cute, and its face has a friendly look. It's
a bit small for what I paid though. I think there
might be other options that are bigger for the
same price. It arrived a day earlier than expected,
so I got to play with it myself before I gave it
to her."""

output = word_count(input_text)
print(output)

3 Vscode连接InternStudio debug笔记

相关推荐
qq_33490315几秒前
用Python实现自动化的Web测试(Selenium)
jvm·数据库·python
2501_908329851 分钟前
嵌入式LinuxC++开发
开发语言·c++·算法
兑生1 分钟前
【灵神题单·贪心】1833. 雪糕的最大数量 | 排序贪心 | Java
java·开发语言
Storynone2 分钟前
【Day30】卡码网:46. 携带研究材料,LeetCode:416. 分割等和子集
python·算法·leetcode
Xpower 173 分钟前
Clawith:开启多智能体协作的新纪元
人工智能·python·语言模型·自动化
兑生5 分钟前
【灵神题单·贪心】3010. 将数组分成最小总代价的子数组 I | Java
java·开发语言·算法
阿钱真强道8 分钟前
28 Python 分类:不只是画一条线,一文认识支持向量机(SVM)
python·支持向量机·分类·svm·边界·核方法·高维
Java面试题总结10 分钟前
go从零单排之方法
开发语言·后端·golang
Jay_Franklin11 分钟前
Python一站式科研工作流:从数据分析到报告生成
开发语言·python·论文笔记
小堃学编程12 分钟前
【项目实战】基于protobuf的发布订阅式消息队列(1)—— 准备工作
java·大数据·开发语言