摘要:
import turtle wn = turtle.Screen() wn.bgcolor("lightgreen") # Set the window background color wn.title("Hello, Tess!") # Set the window title tess = turtle.Turtle() tess.color("blue") # Tell tess to change her color tess.pensize(3) # Tell tess to set her pen width... 阅读全文
摘要:
class stack(object): def __init__(self): self.stack = [] def push(self,str1): self.stack.append(str1) def pop(self): return self.stack.pop() def length(self): return len(self.stack)应该怎么遍历这个堆栈呢?类只有实现了__iter__() 和next()方法(python3改为__next__()),生成的实例才能迭代具有__i... 阅读全文