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

相关推荐
CoderCodingNo几秒前
【GESP】C++五级练习题 luogu-P1182 数列分段 Section II
开发语言·c++·算法
Qt学视觉30 分钟前
AI2-Paddle环境搭建
c++·人工智能·python·opencv·paddle
廋到被风吹走1 小时前
【LangChain4j】特点功能及使用场景
后端·python·flask
Eward-an1 小时前
LeetCode 239. 滑动窗口最大值(详细技术解析)
python·算法·leetcode
青槿吖2 小时前
第二篇:告别XML臃肿配置!Spring注解式IOC/DI保姆级教程,从入门到真香
xml·java·开发语言·数据库·后端·sql·spring
t198751282 小时前
TOA定位算法MATLAB实现(二维三维场景)
开发语言·算法·matlab
喵手2 小时前
Python爬虫实战:用代码守护地球,追踪WWF濒危物种保护动态!
爬虫·python·爬虫实战·濒危物种·零基础python爬虫教学·wwf·濒危物种保护动态追踪
梦想的旅途22 小时前
如何通过 QiWe API 实现企业微信主动发消息
开发语言·python