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

相关推荐
2401_867623987 分钟前
如何管理应用锁_DBMS_LOCK申请自定义锁控制并发逻辑
jvm·数据库·python
basketball6169 分钟前
C++ 命名空间知识点总结:从入门到合理设计
开发语言·c++
BU摆烂会噶10 分钟前
【LangGraph】短期记忆与中断行为
人工智能·python·langchain·人机交互
WL_Aurora12 分钟前
Java多线程详解(一)
java·开发语言
woxihuan12345613 分钟前
SQL数据分析如何剔除极端异常值_配合窗口函数检测偏离度
jvm·数据库·python
2303_8212873813 分钟前
Go 中通过指针实现变量名的“间接引用”与原地修改
jvm·数据库·python
威联通安全存储14 分钟前
制造业数据防勒索:QNAP 快照与 WORM 实践
网络·python
RSTJ_162526 分钟前
PYTHON+AI LLM DAY FOURTY-EIGHT
开发语言·人工智能·python·深度学习
南宫萧幕26 分钟前
HEV能量管理建模实战:从零搭建 Simulink 物理环境到 Python(DQN) 强化学习联合仿真调通
开发语言·python·算法·matlab·汽车·控制
lsx20240635 分钟前
C++ 接口(抽象类)
开发语言