python如何自动打印_python如何实现 random出数字自动打印出与数字对应变量名称...

RT例如random.randint(1,3)1=好,2=不好,3=随便然后随机数字为2的时候直接print出"不好"???求高手!!!!!还有whileuser1:user=input("Pleaseenter1forrock,2forpaper,3forscissorsor-1fo...

RT

例如

random.randint(1,3)

1 = 好, 2 = 不好, 3 = 随便

然后随机数字为2 的时候

直接print 出 "不好"

???

求高手!!!!!

还有

while user1 :

user = input("Please enter 1 for rock, 2 for paper, 3 for scissors or -1 for quit: ")

computerChoice = random.randint(1,3)

if user == -1:

print "Goodbye"

user1 = False

if user == 1:

print "You chose rock"

if user == 2:

print "You chose paper"

if user == 3:

print "You chose scissors"

if computerChoice == 1:

print "The computer chose rock"

if computerChoice == 2:

print "The computer chose paper"

if computerChoice == 3:

print "The computer chose scissors"

如何 在结束的时候 不在打印 computerChoice?

The Rock Paper Scissors Game

Please enter 1 for rock, 2 for paper, 3 for scissors or -1 for quit: -1

Goodbye

The computer chose scissors<======不要这行!!

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值