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

相关推荐
WJ.Polar3 分钟前
Scapy基本应用
linux·运维·网络·python
CSCN新手听安21 分钟前
【Qt】Qt窗口(六)QMessageBox消息对话框的使用
开发语言·c++·qt
H_unique23 分钟前
LangChain:调用工具Ⅲ
python·langchain
醉舞经阁半卷书11 小时前
深入掌握LangChain
python·langchain
CDN3601 小时前
[硬核] 你的DNS正在“裸奔”?用Python手撕DNS劫持与隧道检测逻辑
开发语言·网络·python
froginwe111 小时前
jQuery 添加元素
开发语言
zhangfeng11331 小时前
PHP 语法检查命令 php -l “$file“ > /dev/null 2>&1;
开发语言·php
csbysj20201 小时前
解释器模式
开发语言
kybs19911 小时前
springboot视频推荐系统--附源码72953
java·spring boot·python·eclipse·asp.net·php·idea
CoderCodingNo1 小时前
【信奥业余科普】C++ 的奇妙之旅 | 20:更安全的间接访问——引用的设计动机与实战对比
开发语言·c++