Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
双色球脚本,求大神指导
deepin Talks
586
views ·
5
replies ·
To
floor
Go
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
Like 0
Favorite
View the author
All Replies
aida
deepin
2018-10-30 18:22
#1
666 你做庄家吗哈哈
Reply
Like 0
View the author
eleven2015
deepin
2018-10-31 06:13
#2
这是要每天在家随一注吗。。。
Reply
Like 0
View the author
Ochir
deepin
2018-10-31 07:22
#3
你好骚啊
Reply
Like 0
View the author
wtz
deepin
2018-10-31 10:33
#4
不懂Py的表示这程序似乎已经很简洁明了了……
Reply
Like 0
View the author
yjiqje
deepin
2018-10-31 17:45
#5
逻辑比较简单,用JS就可以实现
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Update driver for my computer
Popular Events
More
目标:输入随机数字开始,打印一注随机选出的彩票,按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退出