FullStackPark / IPS-Lesson

IPS Lession
1 stars 3 forks source link

Python IF #9

Open FullStackPark-Admin opened 6 years ago

FullStackPark-Admin commented 6 years ago

number = 10

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

# int()  强制类型转换

guess = int(input("Enter a number"))

# print("Less than the number")

if guess==number:
    print("Congratulations,You are right")
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")
zhouhongxu commented 6 years ago
number=10
guess=input('enter a number')
if number==guess:
       print('Congratulations,you are right')
elif guess<number:
      if guess<0:
             print('please input a number more than zero')
      else:
      print('Less than the number')
else:
      print('more than the number')
zhouhongxu commented 6 years ago
number=10
guess=input('enter a number')
if number==guess:
       print('Congratulations,you are right')
elif guess<number:
      if guess<0:
             print('please input a number more than zero')
      else:
      print('Less than the number')
else:
      print('more than the number')
zhouhongxu commented 6 years ago
1. number=10
2. guess=input('enter a number')
3. if number==guess:
4.        print('Congratulations,you are right')
5. elif guess<number:
6.       if guess<0:
7.              print('please input a number more than zero')
8.       else:
9.       print('Less than the number')
10. else:
11.       print('more than the number')
zhouhongxu commented 6 years ago

1. number=10
2. guess=input('enter a number')
3. if number==guess:
4.        print('Congratulations,you are right')
5. elif guess<number:
6.       if guess<0:
7.              print('please input a number more than zero')
8.       else:
9.       print('Less than the number')
10. else:
11.       print('more than the nu
12. number=10
13. guess=input('enter a number')
14. if number==guess:
15.        print('Congratulations,you are right')
16. elif guess<number:
17.       if guess<0:
18.              print('please input a number more than zero')
19.       else:
20.       print('Less than the number')
21. else:
22.       print('more than the number')
zhouhongxu commented 6 years ago
number=10
guess=input('enter a number')
if number==guess:
       print('Congratulations,you are right')
elif guess<number:
      if guess<0:
             print('please input a number more than zero')
      else:
      print('Less than the number')
else:
      print('more than the number')
zhouhongxu commented 6 years ago
number=10
guess=input('enter a number')
if number==guess:
       print('Congratulations,you are right')
elif guess<number:
      if guess<0:
             print('please input a number more than zero')
      else:
      print('Less than the number')
else:
      print('more than the number')
zhouhongxu commented 6 years ago
running=True
while running:
    number=10
    guess=int(input('enter a number'))
    if number==guess:
         print('Congratulations,you are right')
         running = False

    elif guess<number:
         print('Less than the number')
    else:
         print('more than the number')