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

相关推荐
Ponp_6 小时前
用 StyleGAN2 做图像数据扩充实战
python·深度学习·生成对抗网络
郝学胜-神的一滴9 小时前
Effective STL 条款15:注意字符串实现上的差异
java·开发语言·数据结构·c++·算法·visualstudio
sharemylove9 小时前
Java学习笔记 —— 面向对象专题
java·开发语言·笔记·学习·课程设计
富贵儿9989 小时前
NL2SQL 实践手记 08:SQL 没报错,答案为什么不对——从失败复盘到 Workflow 修复
数据库·python·sql·ai·自然语言处理·langchain
代码民工正电荷10 小时前
JAVA学习基础(一)
java·开发语言·学习
无巧不成书021811 小时前
最新 PyPI可信发布完整教程 GitHub Actions+OIDC零Token实现Python包自动化发布
python·自动化·github·pypi
至为芯11 小时前
IP5387至为芯支持三路C口140W双向快充新国标移动电源方案芯片
c语言·开发语言·智能手机
星恒随风13 小时前
C++11 加餐(2)并发支持库——mutex、lock_guard、unique_lock 与死锁问题
开发语言·c++
东莞市云毅网络有限公司15 小时前
用 Node 做收录快照的周对比:差集、阈值与告警
python·sqlite·自动化运维·geo·数据监测