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

相关推荐
审判长烧鸡4 分钟前
【Go工具】go-playground是什么组织?官方的?
开发语言·安全·go
PILIPALAPENG27 分钟前
Python 语法速成指南:前端开发者视角(JS 类比版)
前端·人工智能·python
kkeeper~30 分钟前
0基础C语言积跬步之字符函数与字符串函数(上)
c语言·开发语言
hhb_6181 小时前
Swift核心技术难点与实战案例解析
开发语言·ios·swift
用户8356290780511 小时前
Python 操作 PowerPoint 页眉与页脚指南
后端·python
一楼的猫1 小时前
从工具链视角对比:番茄作家助手 vs 第三方写作辅助方案
java·服务器·开发语言·前端·学习·chatgpt·ai写作
程序leo源1 小时前
Qt窗口详解
开发语言·数据库·c++·qt·青少年编程·c#
枫叶林FYL2 小时前
项目九:异步高性能爬虫与数据采集中枢 —— 基于 Crawl<sub>4</sub>AI 与 Playwright 的现代化数据采集平台 项目总览
爬虫·python·深度学习·wpf
likerhood2 小时前
Java static 关键字从浅入深
java·开发语言
猫猫的小茶馆2 小时前
【Python】函数与模块化编程
linux·开发语言·arm开发·驱动开发·python·stm32