|
发表于 2018-1-16 23:31:38
|
显示全部楼层
print ("...........互动小游戏............")# d! R7 w# F/ [9 N: P
$ Z& ^+ }% s( g7 l* M8 ?- I0 q
while True:; F$ u( p- s4 Y
num1 = input("一号玩家设置的第一个加数是:")
4 O6 D' z! K: j3 [# S( P% N& O2 R1 [; u) f* v. [4 F
num1 = int(num1)( {" i& M! s5 _, d6 ], g: i
( {! H/ l) l0 g e; ?: O G
num2 = input("一号玩家设置的第二个加数是:")
7 X; M) o- n) `, h/ s/ V: w5 S) j4 G3 H% G) s' k+ }+ x
num2 = int(num2)' x6 u% [5 W7 @
# C c( ~7 H- O: W) E( k
print("二号玩家开始答题")" `0 B3 n( `" m
7 \2 A8 u; @3 \/ ~( z" a
print(num1,"+",num2)! |% p y/ {4 F, U- r/ W/ u& G: Y. F
- [2 N4 ^5 S7 G: Y7 B, V) k) ] daanz = num1 + num2
, Q) V R2 n/ \$ r
" X$ R& C8 h$ P/ C& V3 X daanz = int(daanz)
; O9 F% h6 T9 u. V! G; D' U' o1 p1 u
' D7 K3 C* [, X! b5 U$ B daanc = input("请问答案等于:")* j1 z0 U% R: c* I0 ~' q
. ?" h ~4 F& p8 ?* y
daanzc = int(daanc)
& d# `' ~4 d# v; d/ T8 Z; ?1 M' Y. }
3 s& F& r4 f* Q2 T; n& i if daanz == daanc:; Q c3 Z* j5 h
% ?5 R" k2 {# D, _
print("你真棒")) `" M4 i: B& @- V1 A' H. i
6 t4 t$ ~; J+ Y. { else:, E- f: Z0 {: ?7 \
& H- W$ y0 X0 w1 Z: Y* W' B# s
print("下次加油")6 ]! F% U7 N, F7 o
' z, o- u0 J% c
print("重新开始")
( ~( g- j% ?5 l& |2 h2 F7 a4 G3 u8 ? |
|