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

相关推荐
一个处女座的程序猿O(∩_∩)O19 小时前
Go语言Map值不可寻址深度解析:原理、影响与解决方案
开发语言·后端·golang
List<String> error_P19 小时前
蓝桥杯基础知识点:模拟-数位操作类题目
python·算法·蓝桥杯
夕除20 小时前
js--22
前端·javascript·python
有点心急102120 小时前
Python 入门
服务器·数据库·python
hwtwhy20 小时前
【情人节特辑】C 语言实现浪漫心形粒子动画(EasyX 图形库)
c语言·开发语言·c++·学习·算法
芒克芒克20 小时前
深入浅出Java线程池(一)
java·开发语言
henry10101020 小时前
Python从入门到精通学习路径(AI生成)
python
wuqingshun31415921 小时前
红黑树有哪些特征
java·开发语言·jvm
ValhallaCoder21 小时前
hot100-贪心
数据结构·python·算法·贪心算法