Python笔记
Nana_1003
这个作者很懒,什么都没留下…
展开
-
turtle乌龟模块画长方形
>>> import turtle >>> bob = turtle.Turtle() 运行上述例子的时候,应该就能新建一个小窗口,还有个小箭头象征小乌龟。如果有的话就 对了,把窗口关掉吧先。 建立一个叫做mypolygon.py的文件,在里面输入如下内容:import turtle bob = turtle.Turtle() #这个小乌龟模块(记着是小写的t)提供了一个叫做Turtle(注意这里是大写的,大小写要去分!)的函数,这..原创 2021-12-11 15:26:14 · 1265 阅读 · 0 评论 -
MIT/Unit 7: Plotting/13. Plotting
Video: PylabVideo: Labels原创 2021-11-08 17:46:31 · 96 阅读 · 0 评论 -
MIT/Unit 6: Algorithmic Complexity/12. Searching and Sorting Algorithms
Video: Bogo SortVideo: Bubble SortVideo: Selection Sort原创 2021-11-08 16:34:20 · 123 阅读 · 0 评论 -
MIT/Unit 6: Algorithmic Complexity/11. Computational Complexity
Video: Program EfficiencyVideo: Big Oh NotationVideo: Complexity ClassesVideo: More Analyzing ComplexityVideo: Recursion Complexity...原创 2021-11-07 20:08:00 · 173 阅读 · 0 评论 -
MIT/Unit 5: Object Oriented Programming/10. An Extended Example
Video: Building a ClassVideo: Visualizing the Hierarchy原创 2021-11-05 17:58:08 · 249 阅读 · 0 评论 -
MIT/Unit 5: Object Oriented Programming/9. Classes and Inheritance
Video: Class Instances原创 2021-10-21 17:56:15 · 89 阅读 · 0 评论 -
MIT/Unit 4: Good Programming Practices/8. Exceptions and Assertions
Exercise 2原创 2021-10-13 17:52:07 · 100 阅读 · 0 评论 -
MIT/Unit 4: Good Programming Practices/7. Testing and Debugging
原创 2021-10-03 16:52:27 · 100 阅读 · 0 评论 -
Course/Unit 3: Structured Types/6. Dictionaries
低效的fibonacci以下为递归和字典效率比较原创 2021-09-28 17:58:23 · 79 阅读 · 0 评论 -
MIT/Unit 3: Structured Types/5. Tuples and Lists
x = (1, 2, (3, 'John', 4), 'Hi')x[2][2]意思是顺序第2个元素里面的第二个元素。x = (1, 2, (3, 'John', 4), 'Hi') 0 1 2 3 0 1 2 01 ...原创 2021-09-27 10:34:16 · 77 阅读 · 0 评论 -
Course/Unit 2: Simple Programs/4. Functions (TIME: 1:08:06)
Calling Functions and ScopeKeyword ArgumentsIteration vs Recursion原创 2021-09-25 16:43:35 · 79 阅读 · 0 评论 -
MIT/Unit 1: Python Basics/Problem Set 1
Problem 1s='azcbobobegghakl'vowels=0for char in s: if char=='a' or char=='e' or char=='i' or char=='o' or char=='u': vowels+=1 print("Number of vowels:"+ str(vowels))Problem 2s = 'azcbobobegghakl'vowels = 0star = 0end = 3while(...原创 2021-09-22 10:19:16 · 103 阅读 · 0 评论 -
MIT/Unit 2: Simple Programs/3. Simple Algorithms
以上 2种写法。二分法二分法减少计算step。原创 2021-09-22 10:18:35 · 62 阅读 · 0 评论 -
python Iteration迭代笔记
笔记说明:1、循环缩进部分,4line-6line2、循环结束,输出print3、test: iter=3, 满足!=0,则ans=0+3=3, iter=3-1=2循环1: iter=2,满足!=0,则ans=3+3=6, iter=2-1=1循环2: iter=1,满足!=0,则ans=6+3=9, iter=1-1=0循环3:iter=0,不满足!=0,输出print结果。注意,while前的条件,仅第1次带入条件,然后用循环中的结果进行再循环。...原创 2021-09-18 12:31:06 · 280 阅读 · 0 评论 -
Python Basics 笔记
问题:>>> s = 'Python is Fun!'>>> s[1:5]'ytho'>>> s[:5]'Pytho'>>> s[1:]'ython is Fun!'>>> s[:]'Python is Fun!'>>> s = 'Python is Fun!'>>> s[1:12:2]'yhni u'>>> s[1:12:3]'.原创 2021-09-15 16:17:00 · 256 阅读 · 0 评论