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

相关推荐
Rsun0455131 分钟前
10、Java 桥接模式从入门到实战
java·开发语言·桥接模式
jieyucx40 分钟前
Golang 完整安装与 VSCode 开发环境搭建教程
开发语言·vscode·golang
pearlthriving42 分钟前
c++当中的泛型思想以及c++11部分新特性
java·开发语言·c++
ronindong1 小时前
Cursor 插件分享 | md-couture:一键将 Markdown 转换成带精美样式的 HTML
人工智能·python·ai编程
智慧地球(AI·Earth)1 小时前
规则引擎实战:Python中re库和pyknow库规则引擎实战教程
开发语言·python·程序人生
是小蟹呀^1 小时前
【总结】LangChain中的中间件Middleware
python·中间件·langchain·agent
qq_342295821 小时前
如何为容器内多个列表实现统一滚动条.txt
jvm·数据库·python
小雅痞1 小时前
[Java][Leetcode hard] 42. 接雨水
java·开发语言·leetcode
We་ct1 小时前
AI辅助开发术语体系深度剖析
开发语言·前端·人工智能·ai·ai编程
t***5441 小时前
Dev-C++中哪些选项可以设置
开发语言·c++