随笔分类 -  Python学习

codecademy_python_class
摘要:###Introduction to Classes```pythonclass Animal(object): #类的声明,括号内填父类,object是最高父类 pass #如果类体暂时为空,则需要填pass作为占位符``````pythonclass Animal(object)... 阅读全文
posted @ 2015-06-07 15:35 絮状颗粒 阅读(171) 评论(0) 推荐(0)
codecademy_python_advanced topics
摘要:###Iterators for Dictionaries```pythonmy_dict = { "name" : "Zhao", "age" : 13, "gender" : 'male' } print my_dict.items() #.items... 阅读全文
posted @ 2015-06-05 22:28 絮状颗粒 阅读(218) 评论(0) 推荐(0)
codecademy_python_loops
摘要:###While / elseSomething completely different about Python is the while/else construction. while/else is similar to if/else, but there is a difference... 阅读全文
posted @ 2015-05-30 17:23 絮状颗粒 阅读(167) 评论(0) 推荐(0)
codecademy_python_Battleship!
摘要:```pythonfrom random import randint #用来产生随机数board = []for x in range(5): board.append(["O"] * 5) # ['O'] * 5 即['O','O','O','O','O'] ,对board列... 阅读全文
posted @ 2015-05-23 20:28 絮状颗粒 阅读(283) 评论(0) 推荐(0)
codecademy_python_Student Becomes the Teacher
摘要:```pythonlloyd = { "name": "Lloyd", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], "tests": [75.0,90.0]}alice = { "nam... 阅读全文
posted @ 2015-05-21 14:09 絮状颗粒 阅读(135) 评论(0) 推荐(0)
codecademy_python_2
摘要:###Python Lists ```pythonsuitcase = [] suitcase.append("sunglasses")# Your code here!suitcase.append("hat")suitcase.append("dress")suitcase.append("ce... 阅读全文
posted @ 2015-05-14 09:08 絮状颗粒 阅读(180) 评论(0) 推荐(0)
codecademy_python_Taking a Vacation
摘要:```python def hotel_cost(nights): return 140 * nights def plane_ride_cost(city): if city == 'Charlotte': return 183 elif city=='Tam... 阅读全文
posted @ 2015-05-10 17:48 絮状颗粒 阅读(117) 评论(0) 推荐(0)
codecademy_python
摘要:学习python的一些记录 阅读全文
posted @ 2015-05-05 13:40 絮状颗粒 阅读(230) 评论(0) 推荐(0)