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

相关推荐
Pocker_Spades_A20 小时前
中秋与代码共舞:用Python、JS、Java打造你的专属中秋技术盛宴
python
梁萌20 小时前
自动化测试框架playwright使用
自动化测试·python·ui自动化·playwright
SccTsAxR20 小时前
[初学C语言]关于scanf和printf函数
c语言·开发语言·经验分享·笔记·其他
Python×CATIA工业智造20 小时前
Python回调函数中携带额外状态的完整指南:从基础到高级实践
python·pycharm
害恶细君20 小时前
【超详细】使用conda配置python的开发环境
开发语言·python·jupyter·pycharm·conda·ipython
java1234_小锋20 小时前
TensorFlow2 Python深度学习 - TensorFlow2框架入门 - 变量(Variable)的定义与操作
python·深度学习·tensorflow·tensorflow2
我星期八休息21 小时前
C++异常处理全面解析:从基础到应用
java·开发语言·c++·人工智能·python·架构
2401_8414956421 小时前
【数据结构】汉诺塔问题
java·数据结构·c++·python·算法·递归·
枫叶丹421 小时前
【Qt开发】输入类控件(五)-> QDateTimeEdit
开发语言·qt
xxxxxxllllllshi1 天前
Java 集合框架全解析:从数据结构到源码实战
java·开发语言·数据结构·面试