书生大模型实战营第三期——入门岛——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笔记

相关推荐
leo__5202 分钟前
MHT多假设跟踪算法(Multiple Hypothesis Tracking)MATLAB实现
开发语言·算法·matlab
燃于AC之乐2 分钟前
深入解剖STL RB-tree(红黑树):用图解带入相关复杂操作实现
开发语言·c++·stl·红黑树·大厂面试·图解·插入操作
夫唯不争,故无尤也4 分钟前
Agent 开发者如何快速上手 SQL:从表设计到 Python 交互的一篇实战入门
python·sql·交互
a1117764 分钟前
堆叠式流程图编辑器(html 开源)
开发语言·前端·javascript·开源·编辑器·html·流程图
小张的博客之旅9 分钟前
2026第十届“楚慧杯”湖北省网络与数据安全实践能力竞赛 (全Writeup)
python·网络安全·openclaw
new code Boy9 分钟前
JavaScript转Python”的速查表
开发语言·javascript·python
老友@12 分钟前
云计算的统一心智模型
开发语言·ci/cd·docker·云计算·k8s·perl
Elnaij15 分钟前
从C++开始的编程生活(19)——set和map
开发语言·c++
杰杰79819 分钟前
深入理解 Django REST Framework 的 Serializer(上)
后端·python·django
程序员敲代码吗21 分钟前
探索数字转换与计算机存储基础
前端·python