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

相关推荐
cch891810 分钟前
Python主流框架全解析
开发语言·python
十五年专注C++开发19 分钟前
RTTR: 一款MIT 协议开源的 C++ 运行时反射库
开发语言·c++·反射
Momentary_SixthSense22 分钟前
设计模式之工厂模式
java·开发语言·设计模式
sg_knight23 分钟前
设计模式实战:状态模式(State)
python·ui·设计模式·状态模式·state
好运的阿财31 分钟前
process 工具与子agent管理机制详解
网络·人工智能·python·程序人生·ai编程
‎ദ്ദിᵔ.˛.ᵔ₎32 分钟前
STL 栈 队列
开发语言·c++
勿忘,瞬间37 分钟前
数据结构—顺序表
java·开发语言
张張40841 分钟前
(域格)环境搭建和编译
c语言·开发语言·python·ai
weixin_423533991 小时前
【Windows11离线安装anaconda、python、vscode】
开发语言·vscode·python
fzb5QsS1p1 小时前
告别重复造轮子,Qt 快速开发脚手架
开发语言·qt·php