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

相关推荐
matlabgoodboy10 分钟前
Python代做java代码编写C++大数据R语言Hadoop/spark/flink/C语言
java·大数据·python
清水白石00810 分钟前
《Python 编程全景解析:透视性能瓶颈——从基础测速到线上热点诊断的高阶实战》
开发语言·python
清水白石00810 分钟前
Python 服务优雅停机实战:信号处理、资源收尾与 Kubernetes 滚动发布避坑指南
python·kubernetes·信号处理
gc_229911 分钟前
学习python使用Ultralytics的YOLO26进行目标检测的基本用法
python·目标检测·yolo26
2301_8042154112 分钟前
模板元编程应用场景
开发语言·c++·算法
2301_8166512215 分钟前
Django全栈开发入门:构建一个博客系统
jvm·数据库·python
乐茵lin16 分钟前
大厂都在问:如何解决map的并发安全问题?三种方法让你对答如流
开发语言·go·编程·map·并发安全·底层源码·sync.map
实心儿儿16 分钟前
C++ —— 红黑树
java·开发语言·算法
松☆19 分钟前
C++ 控制台通讯录管理系统 —— 从零实现到完整解析(附可运行代码)
开发语言·网络·c++