- 博客(11)
- 收藏
- 关注
原创 Analyzing the character of human being
I wanted to analyze a team member when I was a team leader in Shenzhen IBM before. The question is how can I analyze a person using a suitable tool. I came up with the radar map, and I think it is a g...
2019-09-14 11:15:44 155
原创 Lecture 11: Testing and debugging
# Lecture 11 fall 2008def silly(): res = [] done = False while not done: while not done: elem = input('Enter element. Return when done. ') if elem == '':
2017-09-25 00:36:42 200
原创 Lecture 10: Divide and conquer methods, merge sort, exceptions
# Lecture 10 fall 2008def merge(left,right): result = [] i,j = 0, 0 while i < len(left) and j < len(right): if left[i] <= right[j]: result.append(left[i])
2017-09-25 00:35:17 220
原创 Lecture 9: Binary search, bubble and selection sorts
# Lecture 9 fall 2008def bsearch(s, e, first, last, calls): print (first, last, calls) if (last - first) < 2: return s[first] == e or s[last] == e mid = first + (last - first)//2
2017-09-25 00:25:31 157
原创 Lecture 8: Complexity; log, linear, quadratic, exponential algorithms
# code file for lecture 8, 2008 fall#interative exponentdef exp1(a,b): ans = 1# Initiation ans(two more step) while (b>0):#Step1: comparsion ans *= a#Step2: multiplication
2017-09-25 00:24:07 202
原创 Lecture 7_2: Lists and mutability, dictionaries, pseudocode, introduction to efficiency
# example code, Lecture 7, Fall 2008import math#get baseinputOK = Falsewhile not inputOK: base = float(input('Enter base:')) #we get str in python 3x from input, we need to convert str t
2017-09-25 00:21:14 160
原创 Lecture 7_1: Lists and mutability, dictionaries, pseudocode, introduction to efficiency
# example code, Lecture 7, Fall 2008def showDicts(): EtoF = {'one': 'un', 'soccer': 'football', 'never': 'janaie'} print (EtoF['soccer']) input()# print (EtoF[0]) #Dictionary is
2017-09-25 00:17:34 135
原创 Lecture 6: Bisection methods, Newton/Raphson, introduction to lists
# example code, Lecture 6, Fall 2008s = 0for i in range(10): s += 0.1print (s)def squareRootBi(x,epsilon): '''Assumes x >= 0 and epsilon > 0 return y s.t. y*y is within epsilon of
2017-09-25 00:16:14 186
原创 Lecture 4: Decomposition and abstraction through functions; introduction to recursion
# example code, Lecture 4, Fall 2008def sqrt(x): ans = 0 if x >= 0: while ans*ans < x: ans = ans + 1 if ans*ans != x: print (x, 'if not a prefect square')
2017-09-25 00:14:37 249
原创 Lecture 3: Common code patterns: iterative programs
# example code, Lecture 3, Fall 2008x =16ans = 0while ans*ans < x: ans = ans + 1print (ans)x = 1515361ans = 0if x >= 0: while ans*ans < x: ans = ans + 1 print ('ans ='
2017-09-25 00:12:35 146
原创 Lecture 2: Operators and operands; statements; branching, conditionals, and iteration
# sample code for use in Lecture 2, Fall 2008x = 3x=x*xn = input('Enter a number:')print (n)x = 15if (x/2)*2 == x: print ('even')else: print ('odd')z = 'b'if 'x'<z: print ('Hello')
2017-09-25 00:06:04 167
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人