```python
import random
class Number:
countFuNum_0 = []
countFuNum_1 = []
countFuNum_2 = []
countFuNum_3 = []
countFuNum_4 = []
def __init__(self):
self.info1 = '开始集福了!\n 按下<Enter>键获取五福'
self.info2 = "当前拥有的福:"
self.info3 = "获取到:"
def fu(self, fuindex):
self.fuindex = fuindex
if self.fuindex == 0:
Number.countFuNum_0.append(self.fuindex)
print("和谐福")
if self.fuindex == 1:
print("富强福")
Number.countFuNum_1.append(self.fuindex)
if self.fuindex == 2:
Number.countFuNum_2.append(self.fuindex)
print("爱国福")
if self.fuindex == 3:
Number.countFuNum_3.append(self.fuindex)
print("友善福")
if self.fuindex == 4:
Number.countFuNum_4.append(self.fuindex)
print("敬业福")
print("和谐福: %d\t 富强福: %d\t 爱国福: %d\t 友善福: %d\t 敬业福: %d\t" % (len(Number.countFuNum_0),len(Number.countFuNum_1),len(Number.countFuNum_2),len(Number.countFuNum_3),len(Number.countFuNum_4)))
wufu = Number()
print(type(random.randint(0, 4)))
print(wufu.info1 + '\n')
wufuNum = input("Y/N?")
if wufuNum == 'Y':
for i in range(0,3):
print(wufu.info3)
wufu.fu(int(random.randint(0, 4)))
开始集福了!
按下<Enter>键获取五福
Y/N?Y
获取到:
敬业福
和谐福: 0 富强福: 0 爱国福: 0 友善福: 0 敬业福: 1
获取到:
和谐福
和谐福: 1 富强福: 0 爱国福: 0 友善福: 0 敬业福: 1
获取到:
友善福
和谐福: 1 富强福: 0 爱国福: 0 友善福: 1 敬业福: 1
Process finished with exit code 0