提交 966f8f13 编写于 作者: HansBug's avatar HansBug 😆

dev(hansbug): add TODO at the blank position && fix a bug in answer && add...

dev(hansbug): add TODO at the blank position && fix a bug in answer && add template part in my markdown and README.md && update author of iter.md
上级 a5fd6faa
...@@ -262,13 +262,23 @@ int main(int argc, char** argv){ ...@@ -262,13 +262,23 @@ int main(int argc, char** argv){
输出 "Hello,World!" 字符串,找出错的那项。 输出 "Hello,World!" 字符串,找出错的那项。
## template
```python
# this part is used to be displayed in jupyter notebook
if ___name__ == '__main__':
str1 = "Hello,"
str2 = "World!"
print('str1' + 'str2')
```
## 答案 ## 答案
```python ```python
if __name__ == '__main__': if __name__ == '__main__':
str1 = "Hello," str1 = "Hello,"
str2 = "World!" str2 = "World!"
print('str1'+'str2') print('str1' + 'str2')
``` ```
## 选项 ## 选项
......
{ {
"author": "huanhuilong, HansBug", "author": "HansBug",
"source": "iter.md", "source": "iter.md",
"depends": [], "depends": [],
"exercise_id": 190, "exercise_id": 190,
......
...@@ -6,7 +6,7 @@ Python 独步天下的推导式表达式,使用元表推式过滤长度小于 ...@@ -6,7 +6,7 @@ Python 独步天下的推导式表达式,使用元表推式过滤长度小于
def test(): def test():
books = ('程序员修炼之道', '构建之法', '代码大全', 'TCP/IP协议详解') books = ('程序员修炼之道', '构建之法', '代码大全', 'TCP/IP协议详解')
# 此处请为reading进行正确的赋值 # TODO(you): 此处请为reading进行正确的赋值
print("太长的书就不看了,只读短的:") print("太长的书就不看了,只读短的:")
for book in reading: for book in reading:
...@@ -21,10 +21,33 @@ if __name__ == '__main__': ...@@ -21,10 +21,33 @@ if __name__ == '__main__':
请选出下列能**正确**实现这一功能的选项。 请选出下列能**正确**实现这一功能的选项。
## template
```python
def test():
books = ('程序员修炼之道', '构建之法', '代码大全', 'TCP/IP协议详解')
reading = (book for book in books if len(book) <= 4)
print("太长的书就不看了,只读短的:")
for book in reading:
print(" ->《{}》".format(book))
print("可是发现书的名字短,内容也可能很长啊!")
if __name__ == '__main__':
test()
```
## 答案 ## 答案
```python ```python
reading (book for book in books if len(book) <= 4) reading = (book for book in books if len(book) <= 4)
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册