from random import choicescore_person=0score_com=0location=['left','center','right']for i in range (5): print ("----Round %d You kicked----"%(i+1)) com_choice=choice(location) print ("Computer's choice is %s"%com_choice) print ("input what your choice:left/center/right") you_choice=input() print ("You have choose:"+you_choice) if you_choice!=com_choice: # 方向不同,球进! score_person+=1 #人得分 print ("Kicked!") else: print ("Saved unsuccesfully!") #补救 print ("Score:%d(person)-%d(com)/n" %(score_person, score_com)) print ("----Round %d You saved----"%(i+1)) com_choice=choice(location) print ("Computer's choice is %s"%com_choice) print ("input what your choice is:left/center/right") if you_choice==com_choice: #方向相同,球不进! print ("Saved unsucessfully!") score_com+=1 #电脑得分 else: print ("Kicked") print ("Score:%d(person)-%d(com)/n"%(score_person, score_com))