摘要: 好恐怖,连账号密码都忘记了。这这这,不自我否定都不行啊。继续搞起啊!! 阅读全文
posted @ 2017-02-03 12:01 Janice_Zhong 阅读(88) 评论(0) 推荐(0) 编辑
摘要: exercise1: 用函数实现冒泡排序def payxu(list): for i in range(1,len (list)): for j in range(0,len(list)-i): if list[j]>list[j+... 阅读全文
posted @ 2016-01-12 17:59 Janice_Zhong 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 匿名函数:func= lambda a,b:(a+b)*(a-b)print func(2,3)=def fun(a,b) return (a+b)*(a-b)print fun(2,3)sample 1:利用lambda函数实现1+2+3...+100 的和reduce(lambda a,b:a+... 阅读全文
posted @ 2016-01-08 16:07 Janice_Zhong 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 函数语法:语法:def functionname(para): "函数_文档字符串" function_suite return[expression]sample1:print str by defdef printstr(str): "print input str" print str ret... 阅读全文
posted @ 2016-01-07 17:12 Janice_Zhong 阅读(117) 评论(1) 推荐(0) 编辑
摘要: sample 1: 用while 语句实现连续计算:a =float( raw_input("please input a number:"))while a!=0: b=raw_input("please input a operator: ") c=float(raw_input("please... 阅读全文
posted @ 2016-01-07 12:44 Janice_Zhong 阅读(167) 评论(0) 推荐(0) 编辑
摘要: range 和len的并用list=["Monday","Tuesday","Wednesday","Thusday", "Friday","Saturday","Sunday"]for i in range(len(list)):print list[i]Range函数的作用是顺次取出序列的数Le... 阅读全文
posted @ 2016-01-06 16:48 Janice_Zhong 阅读(1458) 评论(0) 推荐(0) 编辑
摘要: sample1 球1+2+3…+100的和sum=0for i in range(1,101): sum+=iprint sumprint 若缩进与sum+齐,则会将每一次sum+的值均打印出来print若与for一起顶格,则只会打印for循环执行完后,最终sum+的值sample2:For循环应用... 阅读全文
posted @ 2016-01-06 16:47 Janice_Zhong 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 1/5/2016 判断表达式应用Sample1:salary=raw_input("please input your salary: ")if salary>=10000:print "you can eat twice!^_^"elif 5000<= salary <10000:print "y... 阅读全文
posted @ 2016-01-05 23:41 Janice_Zhong 阅读(190) 评论(0) 推荐(0) 编辑