双色球脚本,求大神指导
Tofloor
poster avatar
136******97
deepin
2018-10-30 16:37
Author
最近在学习Python3,写了一个机选双色球的脚本
目标:输入随机数字开始,打印一注随机选出的彩票,按0退出。
总感觉不够精简,请大神指导一下。
代码:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#  ssq.py
#  
import random
secret = 0
temp = input("双色球机选一注,输入随机数字回车开始,0结束")
guess = int(temp)
while guess !=secret:
    temp = input("开启你的幸运数字吧:")
    guess = int(temp)
    if guess != secret:
        
   
#红球1-33选6个并排序
        list1=[]  
        hong = random.sample(range(1,34),6)
        hong.sort()#为了美观排序
        list1.append(hong)

#蓝球1-16选1
        list2=[]
        lan =  random.randint(1,17)
        list2.append(lan)

#出彩票 红球6个加蓝球1个
      
        print(list1+list2)
        print("双色球机选一注,恭喜发财!")
#输入任意数字继续,0退出


Reply Favorite View the author
All Replies
avatar
aida
deepin
2018-10-30 18:22
#1
666 你做庄家吗哈哈
Reply View the author
avatar
eleven2015
deepin
2018-10-31 06:13
#2
这是要每天在家随一注吗。。。
Reply View the author
avatar
Ochir
deepin
2018-10-31 07:22
#3
你好骚啊
Reply View the author
avatar
wtz
deepin
2018-10-31 10:33
#4
不懂Py的表示这程序似乎已经很简洁明了了……
Reply View the author
avatar
yjiqje
deepin
2018-10-31 17:45
#5
逻辑比较简单,用JS就可以实现
Reply View the author