import random

class Dice(object):

    sides = ['red','orange','yellow','green','cray','blue']

    def __init__(self,num):
        self.color = self.sides[num]
        print self.color

    @staticmethod
    def calcSum(color1,color2):
        return Dice.sides.index(color1) + Dice.sides.index(color2) + 2

    @classmethod
    def get_dice(cls):
        return cls(random.randint(0,6))

if __name__ == '__main__':
    d1 = Dice.get_dice()
    d2 = Dice.get_dice()
    print Dice.calcSum(d1.color,d2.color)

@@ -1,8 +1,22 @@
+#coding:utf-8%0A
 import r
@@ -133,62 +133,181 @@
 ,num
-):%0A        self.color = self.sides%5Bnum%5D%0A        print 
+=1,iterend=6):%0A        print 'init %3E num:%25s %7C iterend:%25s' %25 (num,iterend)%0A        self.color = self.sides%5Bnum%5D%0A        self.iterend = iterend%0A        print 'init %3E color: ',
 self
@@ -495,16 +495,20 @@
 urn cls(
+num=
 random.r
@@ -520,11 +520,384 @@
 t(0,
-6
+5
 ))
+ # randint(a,b) : a %3C= x %3C= b%0A%0A    def __iter__(self):%0A        self.count = 0%0A        return self%0A%0A    def next(self):#shit! in python3, the func name here should be __next__%0A        if self.count %3C self.iterend:%0A            self.count += 1%0A            self.color = self.sides%5Brandom.randint(0,5)%5D%0A            return self.color%0A        else:%0A            raise StopIteration
 %0A%0Aif
@@ -1013,8 +1013,88 @@
 .color)%0A
+    print '%E2%80%94%E2%80%94%E2%80%94%E2%80%94%E2%80%94%E2%80%94iter%E2%80%94%E2%80%94cut%E2%80%94%E2%80%94%E2%80%94%E2%80%94%E2%80%94%E2%80%94'%0A    for i in Dice(iterend=6):%0A        print i%0A

make dice into a iterator