第四章 :函数与模块
- 定义函数:
def - 函数注释文档
def icessun():
# 这也是注释,下面是函数文档注释,描述函数的用途
"""this is function document as docstring"""
vowels=set('aeiou')
word = input("provide a word to search for vowels:")
found=vowels.intersection(set(word))
for vowel in found:
print(vowel)
- 上面这种函数注释可以,下面这种函数注解是针对python3的也行
def search4letters

本文是《Head First Python》第四章的读书笔记,主要讲解了函数的定义、注释、参数类型、默认值、关键字参数以及模块的使用。探讨了如何通过模块共享函数,包括模块的存放位置、创建及安装过程,让代码组织更有序,便于复用。
最低0.47元/天 解锁文章
720

被折叠的 条评论
为什么被折叠?



