单变量线性回归(Linear Regression with One Variable)¶ In [54]: #初始化工作 import random import numpy as np import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplot
在Python编程中经常会遇到函数(function),方法(method)及属性(attribute)以下划线'_'作为前缀,这里做个总结. 主要存在四种情形: 1. object # public 2. __object__ # special, python system use, user should not define like it 3. __object # private (name mangling during runtime) 4. _object # obey pyt
单链表: 1.定义链表 class ListNode: # 定义节点 def __init__(self, x): self.val = x # 节点当前值 self.next = None # 指向的下一节点,None表示没有下一节点 2.插入数据 # 单链表的插入(在第 s 个结点后面插入 data) def InsertList(self,s,data): if self.IsEmpty() or s < 0 or s > self.LengthList(): print("I