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

相关推荐
2303_Alpha18 分钟前
深度学习入门:深度学习(完结)
人工智能·笔记·python·深度学习·神经网络·机器学习
保利九里19 分钟前
数据类型转换
java·开发语言
蚂蚁在飞-24 分钟前
Golang基础知识—cond
开发语言·后端·golang
Brilliant Nemo35 分钟前
Vue2项目中使用videojs播放mp4视频
开发语言·前端·javascript
深度学习入门1 小时前
机器学习,深度学习,神经网络,深度神经网络之间有何区别?
人工智能·python·深度学习·神经网络·机器学习·机器学习入门·深度学习算法
TNTLWT1 小时前
Qt控件:交互控件
开发语言·qt
量化金策1 小时前
震荡指标工具
开发语言
北漂老男孩1 小时前
ChromeDriver进程泄漏问题分析与最佳实践解决方案
开发语言·爬虫
李迟1 小时前
Golang实践录:在go中使用curl实现https请求
开发语言·golang·https
森哥的歌2 小时前
Python uv包管理器使用指南:从入门到精通
python·开发工具·uv·虚拟环境·包管理