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

相关推荐
小樱花的樱花几秒前
C++引用:高效编程的技巧
开发语言·数据结构·c++·算法
echome8881 分钟前
Python 上下文管理器详解:with 语句的优雅实践
python
南境十里·墨染春水1 分钟前
C++笔记 继承中重载规则 公有私有继承的区别(面向对象)
开发语言·c++·笔记
遇见你...1 分钟前
B03 SpringMVC拦截器
java·开发语言
沉鱼.442 分钟前
进制转换题
开发语言·c++·算法
淼淼7633 分钟前
QT仪表盘
开发语言·qt
wjcroom3 分钟前
融释涡旋理论-对狭义相对论和洛伦兹变换的兼容
开发语言·前端
大明者省3 分钟前
Python 程序在 Ubuntu 系统的完整部署流程
开发语言·python·ubuntu
咸甜适中3 分钟前
rust序列化和反序列化(json、yaml、toml)详解
开发语言·rust·json
智算菩萨4 分钟前
【Tkinter】14 事件处理机制深度解析:从基础绑定到高级传播,构建交互式绘图笔记应用
开发语言·笔记·python·microsoft·ui·ai编程·tkinter