摘要:
##下方代码的知识点及技巧 ###1:三元运算符把结果放在条件判断语句的前面 def small(a, b, c): return a if a<b and a<c else (b if b<a and b<c else c) ###2:python的传参真的很可 只要参数的数量在传递时对的上 de 阅读全文
摘要:
遍历的话若全部遍历则为N,若遍历k次,则为k class Solution: """ @param str: str: the given string @return: char: the first unique character in a given string """ def first 阅读全文
摘要:
由于d=1在while之上会把d=1这个值在下次调用,所以每次的while循环内部d开始都永远为1 while True: # 大循环写死 print('.....................................................') h=input('enter yo 阅读全文
摘要:
前言: 冒泡,选择:使用了普通双指针法 插入,快速,归并:使用了二分法,递归 冒泡排序 原理:不断比较相邻两个数得大小,把较大的数交换到靠后的位置 def bubbleSort(iList): '''冒泡排序 ''' if len(iList) <= 1: return iList for i in 阅读全文
摘要:
a = [] w = input() for x in w: if '0' <= x <= '9': # 这样可以提取出数字 a.append(x) # append函数并不需要返回一个新的列表,并不需要进行赋值操作 continue else: w = w.replace(x,'') # stri 阅读全文