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

相关推荐
意法半导体STM323 小时前
【官方原创】STM32H7双核芯片通过 STlink连接失败问题分析 LAT1654
开发语言·前端·javascript·stm32·单片机·嵌入式硬件
深蓝海拓3 小时前
使用@property将类方法包装为属性
开发语言·python
xiaoye-duck3 小时前
【C++:unordered_set和unordered_map】 深度解析:使用、差异、性能与场景选择
开发语言·c++·stl
zjjsctcdl3 小时前
java与mysql连接 使用mysql-connector-java连接msql
java·开发语言·mysql
格林威3 小时前
Baumer相机锂电池极片裁切毛刺检测:防止内部短路的 5 个核心方法,附 OpenCV+Halcon 实战代码!
开发语言·人工智能·数码相机·opencv·计算机视觉·c#·视觉检测
顶点多余4 小时前
线程互斥+线程同步+生产消费模型
java·linux·开发语言·c++
Albert Edison4 小时前
【ProtoBuf 语法详解】更新消息|保留字段|未知字段
开发语言·c++·protobuf
feifeigo1234 小时前
近场声全息(NAH)数据与MATLAB实现
开发语言·matlab
fie88894 小时前
基于MATLAB的非线性模型预测控制(NMPC)在CSRT系统中的应用
开发语言·matlab
⑩-4 小时前
Java基础+集合框架-八股文
java·开发语言