枚举的应用
from enum import Enum import turtle as t class Color(Enum): red = 1 orange = 2 yellow = 6 green = 4 blue = 5 indigo = 3 purple = 7 t.pensize(8) t.bgcolor('pink') for i in range(1,8): t.color(Color(i).name) t.fd(50) t.circle(50) t.rt(360/7)
from enum import Enum import turtle as t class Color(Enum): red = 1 orange = 2 yellow = 6 green = 4 blue = 5 indigo = 3 purple = 7 t.pensize(8) t.bgcolor('pink') for i in range(1,8): t.color(Color(i).name) t.fd(50) t.circle(50) t.rt(360/7)