while循环
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
numb = 66 print ( "猜测一个我想的数字,你有五次机会" ) count = 1 input_numb = int ( input ( "你猜什么" )) while count < = 5 : if input_numb > numb: print ( "猜测的结果大了" ) a = True elif input_numb < numb: print ( "猜测的结果小了" ) a = True else : print ( "猜测结果正确" ) a = False break count = count + 1 if count < 6 : input_numb = int ( input ( '再猜' )) if a: print ( '这都猜不出来' ) else : print ( '你真聪明' ) |