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

相关推荐
努力实干7 小时前
面向对象设计原则——C++
开发语言·c++·数码相机
NetX行者8 小时前
四语言 Hello World 背后:编译模型与运行时对比
开发语言
Pin_Qing9 小时前
账单没超,请求先被拒了
大数据·开发语言·人工智能
2601_962885729 小时前
如何用 Python 计算 VaR 和 CVaR(在险价值)?
开发语言·python
李航198310 小时前
DeepSeekAI建模三 - 实战建模一组柜子
人工智能·python·计算机视觉·ai·ai编程
郝亚军10 小时前
manifest 中 `sha256` 与 `signValue` 的作用
java·开发语言·数据结构
譕痕10 小时前
stripe 实例
java·开发语言·stripe·checksession
墨子夕10 小时前
设计模式——Java × Python 双语言精讲 · 23 个经典模式 + 现代演进(前言篇)
java·开发语言·设计模式
_菜鸟果果10 小时前
高德地图 JS API 2.0 在国产 Linux/ARM 电脑上渲染失败 的排查与解决
linux·开发语言·javascript
昂好的day11 小时前
VisionMaster(VM) 标定工具详解(上):为什么必须标定 + 九点标定手眼标定
开发语言·数码相机·c#