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

相关推荐
Coding_Doggy7 分钟前
链盾shieldchiain | 团队功能、邀请成员、权限修改、移除成员、SpringSecurity、RBAC权限控制
java·开发语言·数据库
interception11 分钟前
爬虫js逆向,jsdom补环境,抖音,a_bogus
javascript·爬虫·python
林炳然17 分钟前
Python-Basic Day-5 函数-生成器&装饰器
python
f***241125 分钟前
java学习进阶之路,如果从一个菜鸟进阶成大神
java·开发语言·学习
88号技师31 分钟前
2025年9月一区SCI-孤行尺蠖觅食优化算法Solitary Inchworm Foraging-附Matlab免费代码
开发语言·算法·数学建模·matlab·优化算法
Yue丶越31 分钟前
【Python】基础语法入门(四)
linux·开发语言·python
带土140 分钟前
5. QT之Q_OBJECT详解
开发语言·qt
数据牧羊人的成长笔记42 分钟前
Hadoop 分布式计算MapReduce和资源管理Yarn 2
开发语言·php
草莓熊Lotso2 小时前
红黑树从入门到进阶:4 条规则如何筑牢 O (logN) 效率根基?
服务器·开发语言·c++·人工智能·经验分享·笔记·后端
曹牧2 小时前
C#:姓名脱敏
开发语言·c#