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

相关推荐
m0_62457859几秒前
SQL数据分析如何剔除极端异常值_配合窗口函数检测偏离度
jvm·数据库·python
码农学院4 分钟前
itextsharp .net中如何设置两个表格的间距设为0,取网站的域名,协议、端口、当前站点目录的地址
开发语言·c#·.net
川冰ICE4 分钟前
Python爬虫实战⑱|Pandas分组聚合,一键生成统计报表
爬虫·python·pandas
宠..5 分钟前
VS Code 修改 C++ 标准同时修改错误检测标准
java·linux·开发语言·javascript·c++·python·qt
WL_Aurora6 分钟前
Java Scanner输入陷阱深度解析
java·开发语言
2401_880071407 分钟前
Redis怎样查询集群的整体健康状态_使用cluster info指令查看槽位覆盖率与节点状态
jvm·数据库·python
2301_815901979 分钟前
Go语言如何写负载均衡器_Go语言负载均衡器实战教程【完整】
jvm·数据库·python
Han_han91911 分钟前
斗地主案例:
java·开发语言
dFObBIMmai14 分钟前
Redis怎样定位每秒被高频访问的热点键
jvm·数据库·python
m0_6091604914 分钟前
golang如何实现负载均衡器组件_golang负载均衡器组件实现详解
jvm·数据库·python