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

相关推荐
charlie1145141919 小时前
通用GUI编程技术——Win32 原生编程实战(十八)——GDI 设备上下文(HDC)完全指南
开发语言·c++·ide·学习·visual studio·win32
Mr YiRan9 小时前
JNI技术之动态注册与JNI线程实战
开发语言
庄小法9 小时前
pytest
开发语言·python·pytest
sonnet-10299 小时前
堆排序算法
java·c语言·开发语言·数据结构·python·算法·排序算法
csdn_zhangchunfeng9 小时前
Qt之智能指针使用建议
开发语言·qt
2401_895521349 小时前
Golang 构建学习
开发语言·学习·golang
墨香幽梦客9 小时前
大数据环境下的BI架构:Hadoop与Spark的企业级应用整理
java·开发语言
熊猫_豆豆9 小时前
Python月球、地球、太阳三天体联动一个月的月相图
python·农历·月亮
2301_810160959 小时前
C++中的状态模式
开发语言·c++·算法
码路星河9 小时前
SpringBoot3实战:优雅实现Word文档动态生成与下载
开发语言·c#·word