In [6]:
n=int(input('Please input an integer,and end with Enter.'))
i=0
j=0

def sum_(a):
    total=0
    for i in range(a):
        j=int(input('Please input an integer,and end with Enter.'))
        total=total+j
    return total
    
print('This is the sum of these numbers:',sum_(n))


Please input an integer,and end with Enter.3
Please input an integer,and end with Enter.1
Please input an integer,and end with Enter.2
Please input an integer,and end with Enter.3
This is the sum of these numbers: 6

In [7]:
i=0
ms=[0]

for i in range(1000): 
    n=int(input('Please input an integer,and end with Enter'))
    print('if you do not want to input numbers,please input out,if you want to continue inputing,please input in')
    m=input()
    if 'out'==m:
        break
    else:
        continue


Please input an integer,and end with Enter1
if you do not want to input numbers,please input out,if you want to continue inputing,please input in
in
Please input an integer,and end with Enter1
if you do not want to input numbers,please input out,if you want to continue inputing,please input in
out

In [ ]:
i=0
j=0 
m=0 
n=0 
b=0 
a=0
for i in range(1000): 
    print('Please input an integer,and end with Enter.') 
    a=int(input()) 
    m=m+a 
    n=n*a 
    if m<a and n<a*a: 
        break 
    else:
        continue


Please input an integer,and end with Enter.

In [1]:
def _sum(end): 
    i=0 
    total=1
    for i in range(end):
        i=i+1
        total=total*i

    return total
m=int(input('请输入一个整数,以回车结束')) 
n=int(input('请输入一个整数,以回车结束')) 
k=int(input('请输入一个整数,以回车结束'))
print('最终和是:',_sum(m)+_sum(n)+_sum(k))


请输入一个整数,以回车结束2
请输入一个整数,以回车结束4
请输入一个整数,以回车结束3
最终和是: 32

In [12]:
def he(a,b,c):
    i=0
    total=0
    i=a
    j=0
    for j in range(1000):
        total=total+i
        i=i+c
        if i>b:
            break
        else:
            continue
    return total
        
m=int(input('请输入一个整数'))
n=int(input('请输入一个整数'))
k=int(input('请输入一个整数'))
print(he(m,n,k))


请输入一个整数1
请输入一个整数9
请输入一个整数1
45

In [15]:
def end(a):
    i=1
    total=0
    j=0
    k=0
    
    for k in range(10000000000):
        if(j%2==0):
            total=total-1/i
        else:
            total=total+1/i
        i=i+2
        j=j+1
        if(i>=a):
            break
        else:
            continue
        
    return total

b=int(input('请输入一个整数,以回车结束'))
print(end(b)*4)


请输入一个整数,以回车结束100000
-3.1415726535897814

In [16]:
import math,random
def c_sqrt():
    n=int(input('请输入一个整数,以回车键结束'))
    m=int(input('请输入一个整数,以回车键结束'))
    k=int(input('请输入一个整数,以回车键结束'))
    i=0
    total=0
    num=0
    for i in range(n):
        num=random.randint(m,k)
        total=total+num
    total=math.sqrt(total/n)
    print(total)

c_sqrt()


请输入一个整数,以回车键结束9
请输入一个整数,以回车键结束1
请输入一个整数,以回车键结束8
2.160246899469287

In [17]:
import math,random
def c_log():
    n=int(input('请输入一个整数,以回车键结束'))
    m=int(input('请输入一个整数,以回车键结束'))
    k=int(input('请输入一个整数,以回车键结束'))
    i=0
    total=0
    num=0
    for i in range(n):
        num=random.randint(m,k)
        num=math.log10(num)
        total=total+num
    print(total)

c_log()


请输入一个整数,以回车键结束9
请输入一个整数,以回车键结束1
请输入一个整数,以回车键结束6
4.510545010206613

def sum_(n): number=[] total=0 for i in range(n): num=int(input("Please input an interge, end with Enter")) num.append(number) for num in number: total=total+num print(total)

a=int(input("please input an interge, end with Enter")) sum_(a)

def sum_(): number=[] total=0 num=0 for i in range(10): num=input() number.append(num) for num in number: total=total+num print(total)

sum_()


In [8]:
number=[1,2,3,4,5,6,7,8,9]
total=0
num=0
for num in number:
    total+=num
print(total)


45

In [10]:
number=[]
min=0
num=0
i=0
n=int(input())
for i in range(n):
    num=int(input())
    number.append(num)
min=number[0]
for num in number:
    if min<num or min==num:
        min=min
    else:
        min=num
print(min)


2
1
2
1

In [12]:
number=[12,13,24,45,56,36,32]
num=0
l=0
n=int(input())
l=len(number)
if n<=l:
    print(number[n-1])
else:
    print("none")


2
13

In [14]:
import math
def cosine():
    x1=int(input("请输入x1"))
    x2=int(input("请输入x2"))
    y1=int(input("请输入y1"))
    y2=int(input("请输入y2"))
    cos=(x1*x2+y1*y2)/(math.sqrt(x1*x1+y1*y1)+math.sqrt(x2*x2+y2*y2))
    print(cos)
cosine()


请输入x12
请输入x23
请输入y11
请输入y24
1.381966011250105

In [18]:
a=5
b=5
c=100-a-b
count=0
for i in range(5,90):
    count+=1
    a+=1
    c=100-a-b
    if c==5:
        break
for i in range(5,90):
    count+=1
    b+=1
    c=100-a-b
    if c==5:
        break
print(count)


170