- 博客(3)
- 收藏
- 关注
原创 python: assert testing 笔记
from xxx(.py文件)import xxx(def名称) #test functions in the new program def two_output(): expected = (2.5, 1.0) actual = quadratic(2, -7, 5) assert actual == expected, "Test 1 : failed!" expected = 期望的输出结果;actual = 运行function后的实际结果 assert ac..
2021-10-14 22:05:37 139
原创 .join 笔记
ls = ['hello','world','welcome','back'] print(' '.join(ls)) hello worldgood morning enter = int(input('enter a number ')) line = 0 while line < enter: line += 1 num = 0 ls = [] while num <= line: num += 1 ls.appen..
2021-09-19 13:25:44 241
原创 Nested loops笔记
1. Nested loop example- multiple values input and check: break实施后结束内部while loop,由于valid在满足条件后被改为True,也可停止内部while loop。 直到validility check通过,即可i+=1进行下一个输入并检测。因此i+=1需要在外部while loop中体现。 n = 5 i = 0 ls = [] while i < 5: #check validility valid =
2021-09-18 20:30:52 141
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人