In [3]:
n = int(input("please input an int number: "))
i = 0
fac = 1
while i < n:
    i = i+1
    fac = fac*i
print(fac)


please input an int number: 5
120

In [1]:
name = input('please input your name and end with Enter')
print('Hello',name)

n = int(input('please input an int number and end with Enter'))
m = int(input('please input an int number and end with Enter'))

print('the total number is: ',m+n)
print('Bye!',name)


please input your name and end with Enterzxy
Hello zxy
please input an int number and end with Enter3
please input an int number and end with Enter2
the total number is:  5
Bye! zxy

In [1]:
n = int(input('please input the number of int numbers: '))
print(n)

sum = 0
i = 0
while i < n:
    n -= 1 
    m = int(input('please input an int number: '))
    sum = sum + m
print(sum)


please input the number of int numbers: 5
5
please input an int number: 1
please input an int number: 2
please input an int number: 3
please input an int number: 4
please input an int number: 5
15

In [2]:
i = 1
while i:
    i = input('请输入一个数字,或回车退出。')


请输入一个数字,或回车退出。2
请输入一个数字,或回车退出。3
请输入一个数字,或回车退出。4
请输入一个数字,或回车退出。

In [ ]:
i = 1
sum = 0
product = 1
while i:
    i = int(input('请输入一个数字: '))
    sum = sum + i
    product = product * i
    if sum < i and product < i**2:
        print('已输入所有数字之和',sum,'小于当前输入的',i,',且输入所有数字的积',
              product,'小于当前输入数字的平方',i**2)


请输入一个数字: -10
请输入一个数字: 2
已输入所有数字之和 -8 小于当前输入的 2 ,且输入所有数字的积 -20 小于当前输入数字的平方 4