![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
FeelingFannie
这个作者很懒,什么都没留下…
展开
-
MIT6001x_Review_Lec3_Loops, Strings, Guess-and-Check, Approximation, Bisection
stringsa sequence of case-sensitive characterscan compare: ==. <, >, <=, >=>>> 'a' < 'b'True## alphabetic order len()aStr[ ] indexing and slicingimmutableQuesiont: Finding the cube root(三次方根)of a number.Approximate原创 2020-07-18 12:10:58 · 165 阅读 · 0 评论 -
return +判断列表A包含列表B的所有元素
Returndef fun1(): return x = 1SyntaxError: invalid syntaxdef fun1(): x = 1 return x Decide whether all the elements of List A are in List BlistA = [1, 2, 3]listB = [1, 2, 3, 4]listB contains listAlistA = [1, 2, 3]listB = [1, 2, 3, 4]原创 2020-07-16 12:06:38 · 431 阅读 · 0 评论 -
复制词典与列表
when copying a dict:aDict.copy()if you try to use aDict[:]TypeError: unhashable type: ‘slice’Python definition of Hashable is: An object is hashable if it has a hash value which never changes during its lifetime (it needs a hash() method).A list is原创 2020-07-16 11:49:42 · 141 阅读 · 0 评论