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

相关推荐
落魄实习生6 分钟前
Agent Scope Java 2.x 系列【7】工具使用
java·开发语言·ai
心之语歌9 分钟前
Tkinter 画布基本梳理
运维·服务器·python
茉莉玫瑰花茶37 分钟前
GO [ 方法 ]
开发语言·后端·golang
Wx-bishekaifayuan39 分钟前
django个性化旅游路线推荐平台49005-计算机课程设计、毕业设计
spring boot·后端·python·django·课程设计·express·旅游
狗凯之家源码网1 小时前
微博图床 PHP 系统搭建与实战应用指南
android·开发语言·php
小白快快跑哦2 小时前
python-字符串全解(六):正则表达式-量词
python·正则表达式·字符串
禹凕2 小时前
机器学习之Selenium(Machina Learning about Selenium)
爬虫·python·selenium·测试工具·机器学习
乌暮3 小时前
深入理解 Java 泛型:把「万能盒子」用对、用稳
java·开发语言·后端·学习
2601_962218613 小时前
C语言中三种库的编译和使用方法
开发语言·c++
传奇开心果编程3 小时前
中庸、有容、破执:仓颉编程语言的中华智慧结晶——三重哲学境界思辨
开发语言·华为·开源·软件工程