Python学习之not,and,or篇 运算符示意 not –表示取反运算. and –表示取与运算. or –表示取或运算. 运算符优先级 not > and > or. 举例如下: bool_one = False or not True and True print bool_one bool_two = False and not True or True print bool_two bool_three = True and not (False or False) print…
from random import randint face1=randint(1,6) face2=randint(1,6) first_point=face1+face2 print('玩家摇出了:%d点'% first_point) go_on=False if first_point==7 or first_point==11: print('玩家胜') elif first_point==2 or first_point==3 or first_point==12: print('庄…
猜数字游戏 系统生成一个100以内的随机整数, 玩家有6次机会进行猜猜看,每次猜测都有反馈(猜大了,猜小了,猜对了-结束) 6次中,猜对了,玩家赢了. 否则系统赢了 #!/usr/bin/env python import random secret=random.randint(1,100) guess=0 tries=0 print "This game is to guess a number for you!" print " It is a number f…