FullStackPark / IPS-Lesson

IPS Lession
1 stars 3 forks source link

Python While #10

Open FullStackPark-Admin opened 6 years ago

FullStackPark-Admin commented 6 years ago

number = 10
running = True
# input("string")
# 1. 往控制台输出一句话 string
# 2. 在控制台等待用户的输入
# 3. 得到用户的输入

# int()  强制类型转换
while running:
    guess = int(input("Enter a number"))

    # print("Less than the number")

    if guess==number:
        print("Congratulations,You are right")
        running = False
    elif guess < number:
        if guess < 0:
            print('Please input a number more than zero')
        else:
            print("Less than the number")
    else:
        print("Bigger than the number")