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

相关推荐
萝卜白菜。1 分钟前
TongWeb8.0 JNDI缓存
开发语言·python·缓存
xiaoshuaishuai83 分钟前
PyCharm性能调优
ide·python·pycharm
XMYX-011 分钟前
03 - Go 常用类型速查表 + 实战建议(实战向)
开发语言·golang
爱码驱动12 分钟前
Java多线程详解(5)
java·开发语言·多线程
@atweiwei22 分钟前
用 Rust 构建 LLM 应用的高性能框架
开发语言·后端·ai·rust·langchain·llm
九转成圣25 分钟前
实战记录:用 Java 拼接长图/网格图,我踩了哪些坑?
java·开发语言
&&Citrus29 分钟前
【CPN 学习笔记(三)】—— Chap3 CPN ML 编程语言 上半部分 3.1 ~ 3.3
笔记·python·学习·cpn·petri网
lzhdim31 分钟前
SQL 入门 9:SQL 高级子查询:ANY、EXISTS 与多位置应用
java·开发语言·数据库·sql·mysql
Dream of maid32 分钟前
Python(11) 进程与线程
开发语言·python
财经资讯数据_灵砚智能40 分钟前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年4月7日
大数据·人工智能·python·信息可视化·语言模型·自然语言处理·ai编程