|
|
вернуться в форумWhy do I get Runtime Error for solution in Python 3.4 Послано SabraO 1 июн 2016 19:15 import sys; import math; class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def size(self): return len(self.items) size = 0 intSize = sys.getsizeof(int()); s = Stack(); while (size<100): line = input(); if (not line.isspace()): values = [int(s) for s in line.split() if s.isdigit()]; size += intSize; for value in values: s.push(math.sqrt(value)); while (s.size()>0): print("%.4f" % (s.pop())); Re: Why do I get Runtime Error for solution in Python 3.4 > while (size<100): How did you receive magic number "100"? Shouldn't you read input until EOF? |
|
|