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

相关推荐
月亮邮递员6167 分钟前
Markdown语法总结
开发语言·前端·javascript
printfLILEI7 分钟前
php中的类与对象以及反序列化
linux·开发语言·php
曹牧8 分钟前
C#:主线程能够捕获到子线程中的异常
开发语言·数据库·c#
代码中介商8 分钟前
深入解析STL中的stack、queue与priority_queue
开发语言·c++
彦为君13 分钟前
JavaSE-07-异常机制
java·开发语言·后端·python·spring
OxyTheCrack30 分钟前
【Golang】简述make与new内置函数以及两者的区别
开发语言·golang
适应规律33 分钟前
【无标题】
人工智能·python·算法
Rain50940 分钟前
mini-cc 的 MCP 协议:给 AI 装个 USB-C 接口
c语言·开发语言·前端·人工智能·架构·node.js·ai编程
XLYcmy40 分钟前
全链路验证测试系统:一个针对智能代理(Agent)系统全链路能力的自动化验证脚本
分布式·python·http·网络安全·ai·llm·agent
有味道的男人1 小时前
电商效率翻倍:京东全量商品信息抓取
python