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

相关推荐
belldeep7 小时前
python:genesis-world, Genesis-Embodied-AI
人工智能·python·ai·genesis
布莱克6057 小时前
C/C++ 中变量的声明与定义:区别、联系与常见误区
c语言·开发语言·c++·声明·定义
LabVIEW开发7 小时前
LabVIEW 局部变量为何引发竞争条件?四种同步机制
开发语言·labview
benchmark_cc8 小时前
A 股、港股、美股如何建立统一的标的主数据格式?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
维克兜率天8 小时前
【维克】趋势型CTA:期货市场的“追涨杀跌“
人工智能·python
Zenova EdgeOS9 小时前
Go 工业边缘错误处理实战:用 errors 构建可追溯错误链
开发语言·数据库·golang
取名真是9 小时前
Python 算法知识点从基础到进阶
开发语言·python·算法
梦想不只是梦与想9 小时前
PyTorch、CPU、GPU、CUDA
人工智能·pytorch·python·深度学习·机器学习·cuda
数字融合9 小时前
透明化视频孪生危化安全管控解决方案
人工智能·python·安全
FRing039 小时前
vue2干货总结3(computed计算属性、watch监听器)
开发语言·前端·vue.js·vue2