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

相关推荐
Str_Null5 分钟前
杀戮尖塔通过修改记录文件和备份文件进行修改血量和金币
python
钝挫力PROGRAMER8 分钟前
复杂PDF转Markdown实战:从Marker到多模态的处理全记录
python·pdf
TechWayfarer14 分钟前
账号安全实战:基于IP归属地基线的三原则异地登录风控模型
服务器·网络·python·安全·网络安全
ZGi.ai18 分钟前
私有化大模型接入企业系统:SSO+权限+API网关完整方案
java·开发语言·大模型·私有化部署·sso·企业架构
一念春风27 分钟前
记事本(C#)
开发语言·c#
dhashdoia31 分钟前
2026年GPT-5.5与GPT-Image-2深度解析:国内部署指南
人工智能·python·gpt·ai作画·gpt国内部署
fox_lht35 分钟前
第十二章 泛型、接口和生命周期
开发语言·后端·rust
jayson.h36 分钟前
正则表达式:从文件名提取器件编号
开发语言·python·正则表达式
Dxy123931021638 分钟前
JS如何获取元素高度
开发语言·javascript·ecmascript
凯瑟琳.奥古斯特1 小时前
页面置换算法详解与对比
开发语言·分布式·职场和发展