Guess Number 猜数字

一、说明

使用python编写的猜数字游戏

二、python代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
lucky_number = 12
count = 6

while (count>0):

input_number = (int)(input("please input a number from 0 t 100:"))
count = count - 1

if input_number<lucky_number:
print("the lucky number is bigger")
elif input_number>lucky_number:
print("the lucke number is smaller")
else:
print("bingo")
break

else:
print("you have no chance")