Facebook
From Sloppy Parakeet, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 208
  1. class Value:
  2.     def __init__(self, value, pos, next):
  3.         self.position = pos
  4.         self.value = value
  5.         self.next = next
  6.  
  7.     def show_val(self):
  8.         return self.value
  9.  
  10.     def show_next(self):
  11.         return self.next
  12.  
  13.     def show_pos(self):
  14.         return self.position
  15.  
  16.     def change_next(self):
  17.         self.next += 1
  18.  
  19. class List(Value):
  20.     def __init__(self):
  21.         self.values = []
  22.         self.values.append(Value(0, 0, 0))
  23.         self.values.append(Value(0, 1, 0))
  24.  
  25.     def show(self):
  26.         for i in self.values:
  27.             print('Position:' +  str(Value.show_pos(i)))
  28.             print('Value:' +  str(Value.show_val(i)))
  29.             print('Next val: ' + str(Value.show_next(i)))
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. list = List()
  39.  
  40.  
  41.  
  42.  
  43.  
  44. list.show()