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

相关推荐
2501_941111373 分钟前
Django全栈开发入门:构建一个博客系统
jvm·数据库·python
枫叶丹49 分钟前
【Qt开发】Qt窗口(二) -> QToolBar工具栏
开发语言·数据库·c++·qt
熙客18 分钟前
Java集合框架概述
java·开发语言
我命由我1234528 分钟前
Java 开发 - 简单消息队列实现、主题消息队列实现
java·开发语言·后端·算法·java-ee·消息队列·intellij-idea
chilavert31829 分钟前
技术演进中的开发沉思-194 JavaScript: Prototype 框架
开发语言·javascript·原型模式
2501_9412374529 分钟前
高性能计算通信库
开发语言·c++·算法
杜子不疼.35 分钟前
【C++】红黑树为什么比AVL快?用C++亲手实现告诉你答案
开发语言·c++
程序猿追37 分钟前
Ascend C编程范式总结:与CUDA的异同对比
c语言·开发语言·算法
沐知全栈开发2 小时前
HTML DOM 修改
开发语言
2501_941236213 小时前
C++与Node.js集成
开发语言·c++·算法