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

相关推荐
小刘学技术5 分钟前
AI人工智能中的类别不平衡问题:成因、影响与解决方案
开发语言·人工智能·python·机器学习
兰令水11 分钟前
hot100【acm版】【2026.7.21打卡-java版本】
java·开发语言·算法·leetcode·面试
郝同学今天有进步吗14 分钟前
构建 LangGraph Code Review Agent(二):建立仓库路径安全边界
python·ai·code review
2501_9142459321 分钟前
Java应用性能调优与生产监控部署:2026年实战手册
java·开发语言
雨师@25 分钟前
python通过rust编写组件扩展自己的能力
python·rust
时光不染。回忆不淡40 分钟前
Python基础语法教程
开发语言·python
爱喝水的鱼丶1 小时前
SAP-ABAP:一次关于“交货日期”的增强需求:从复杂增强到标准功能的回归之旅
运维·开发语言·性能优化·sap·abap·经验交流
白执落1 小时前
使用 Python + LangChain + Vue3 构建 LLM 聊天应用
人工智能·python·langchain
蓝创工坊Blue Foundry1 小时前
本地 PDF、图片字段提取到 Excel:用文档工作台的完整流程
python·ocr·vim·paddlepaddle
星恒随风1 小时前
C++ STL 详解:list 的使用、迭代器失效、模拟实现与 vector 对比
开发语言·数据结构·c++·笔记·学习·list