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

相关推荐
阿正的梦工坊8 分钟前
JavaScript 微任务与宏任务完全指南
开发语言·javascript·ecmascript
2301_8166602118 分钟前
PHP怎么处理Eloquent Attribute Inference属性推断_Laravel从数据自动推导类型【操作】
jvm·数据库·python
第一程序员18 分钟前
数据工程 pipelines 实践
python·github
知行合一。。。42 分钟前
Python--05--面向对象(属性,方法)
android·开发语言·python
郝学胜-神的一滴1 小时前
深度学习必学:PyTorch 神经网络参数初始化全攻略(原理 + 代码 + 选择指南)
人工智能·pytorch·python·深度学习·神经网络·机器学习
青梅橘子皮1 小时前
C语言---指针的应用以及一些面试题
c语言·开发语言·算法
qq_372154231 小时前
Go 中自定义类型与基础类型的显式转换规则详解
jvm·数据库·python
浅时光_c1 小时前
3 shell脚本编程
linux·开发语言·bash
Evand J2 小时前
【三维轨迹目标定位,CKF+RTS,MATLAB程序】基于CKF与RTS平滑的三维非线性目标跟踪(距离+方位角+俯仰角)
开发语言·matlab·目标跟踪
LiAo_1996_Y2 小时前
CSS如何实现文字渐变效果_通过background-clip实现艺术字
jvm·数据库·python