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

相关推荐
渣渣xiong13 分钟前
从零开始:前端转型AI agent直到就业第五十七天-第五十八天
前端·人工智能·python
吃好睡好便好17 分钟前
创建魔方矩阵和单位矩阵
开发语言·人工智能·学习·线性代数·matlab·矩阵
影寂ldy21 分钟前
C#数组的属性和方法(Clear / Copy / IndexOf )
开发语言·javascript·c#
i7i8i9com21 分钟前
Hermes Agent 安装记录
开发语言·bash·hermes
小娄~~1 小时前
C语言卷子错题集
c语言·开发语言·数据结构
小L~~~1 小时前
基于贪心策略的混合遗传算法求解01背包问题
python·算法
才兄说1 小时前
机器人二次开发机器人动作定制?动作迁移数据优化
python
用户8356290780511 小时前
用 Python 实现 Excel 散点图绘制与定制
后端·python
PAK向日葵2 小时前
从零实现 Python 虚拟机(一):PVM 基本原理介绍
python
神所夸赞的夏天2 小时前
创建虚拟环境提示SSLError错误
python