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

相关推荐
small_white_robot1 分钟前
idek-2022 web 全wp——持续更新
开发语言·前端·javascript·网络·安全·web安全·网络安全
LJianK13 分钟前
乐观锁算线程同步吗?
java·开发语言·jvm
Metaphor6924 分钟前
使用 Python 加密或解密 Word 文档
python·安全·word
铭毅天下5 分钟前
当搜索引擎遇上 Rust——深度解读下一代实时搜索引擎 INFINI Pizza
开发语言·后端·搜索引擎·rust
IT策士10 分钟前
Python 中间件系列:文件存储minio操作操
开发语言·python·中间件
buhuizhiyuci13 分钟前
【QT-百日筑基篇】功法有些小成,开始进行打怪升级-QT的实践第一课,创建Hello World的几种方法
开发语言·qt
枕星而眠19 分钟前
Linux 共享内存与信号量全解析:原理、实践与避坑指南
linux·c语言·开发语言·后端·ubuntu
Ulyanov20 分钟前
《从质点到位姿:基于Python与PyVista的导弹制导控制全栈仿真》: 驯服猛兽——自动驾驶仪(Autopilot)设计与舵机动力学
python·自动驾驶·雷达电子对抗
Sanri.24 分钟前
JavaScript基础语法6
开发语言·javascript·ecmascript
hhb_61827 分钟前
JavaScript核心技术要点梳理与实战应用案例解析
开发语言·javascript·ecmascript