##Python语⾔程序设计刘卫国主编课后实验
a=2
b=1234
c=a+int(b)%10
print(a,'\t',b,'\t',c)
import math
dir(math)
help(math)
x=12
y=x
id(x),id(y)
a=int(float('7.34'))%4
print(a)
jsp文件苹果手机打开方式b=1<<10|10
print(b)
import math
math.pi
c=4/3*(math.pi)**3#这⾥%是取余运算/才是数学运算中的除法
print(c)
#print(math.sqrt(9))#开根号运算
import cmath
print(2/(1-(0+7J)**0.5))#法1
print(2/(1-cmath.sqrt(0+7J)))#法2
x=12
y=10e-5
import math
tcp动态网络模型print(1+x/math.factorial(3)-y/math.factorial(5))
x=12
y=10e-5
import math
print(2*math.log(math.fabs(x-y))/(p(x+y)-math.tan(y)))
print(math.sin(x)+s(y)/(x**2+y**2)+x**y/(x*y))
print(math.e**((math.pi)/2*x)+math.log10(math.fabs(x-y)/(x+y)))
import math
p=(math.pi)**2
print(p)
a=list(range(15))
b=list(range(1,15))
print(a)
print(b)
print(list(range(1,100,2)))
print("byebye,python program")
import math
a=2
b=3
print(math.fabs(a-b))
i,j=3,4
i,j=2j,i
s=i+j
print("s=",s)
import math
x=(1+math.pi)**(1/3)
y=(math.e**(-x)-math.tan(73))/(1e10-5+math.log(math.fabs(math.sin(x)**s(x)**2),math.e)) print(y)
a=int(input())
if a>40:
print("a1=",a)
php是单词吗if a<50:
print("a2=",a)
if a>30:
print("a3=",a)
x=2.1
y=2.0
if(x-y)-0.1<1e-6:
print("equal")
else:
print("not equal")
m=int(input())
if m%3==0or m%7==0:
print("yes")
else:
print("no")
n=int(input())
if n%2==0:
print(n**3)
else:
print(n**2)##法1
n=int(input())python程序设计基础教程电子书
p=n%2
if p:#奇数
print(n**2)
if not p:#偶数
print(n**3)#法2
n=int(input())
p=n**(1/3)if n%2==0else n**2
print(p)
x,y,z =map(int,input().split())
p=x**2+y**2+z**2
if p>1000:
print(int(p/1000))
else:
contatenate函数print(p)
x,y,z =map(int,input().split())
if x+y>z and y+z>x and x+z>y:
print("可以构成三⾓形")
if((x==y and x!=z )or(x==z and x!=y)or(y==z and y!=x)):
print("该三⾓形是等腰三⾓形")
elif(x==y and x==z):
print("该三⾓形是等边三⾓形")
elif(x**2+y**2==z**2or x**2+z**2==y**2or y**2+z**2==x**2): print("该三⾓形是直⾓三⾓形")
else:
print("该三⾓形是普通三⾓形")
else:
print("不能构成三⾓形")
a,b,c=eval(input("请输⼊当前⽇期:"))
x,y,z=eval(input("请输⼊你的出⽣⽇期:"))
if(b-y>=1):
print("你今年%d岁"%(a-x+1))
else:
print("你今年%d岁"%(a-x))
p,w,s=eval(input("请分别输⼊基本运费,货物重量,距离:")) if s<250:
d=0
elif250<=s<500:
d=0.025
elif500<=s<1000:
d=0.045
elif1000<=s<2000:
d=0.075
elif2000<=s<2500:
d=0.09
elif2500<=s<3000:
d=0.12
else:
d=0.15
f=p*w*s*(1-d)
print(f)
i=1
while i+1:
if i>4:
print(i)
i+=1
break
print(i)
i+=2
sum=j=1
while j<=3:
f=1
for i in range(2,2*(j+1)):
f*=i
sum+=f
j+=1
print("sum=",sum)
import math
n=0
for m in range(101,201,2):
k=int(math.sqrt(m))
for i in range(2,k+2):
if m%i==0:break
if i== k+1:
if n%10==0:print()
print(m,end=' ')
n+=1
max1=min1=0
for i in range(1,6):
sum=0
for j in range(1,7):
x=int(input())
sum+=abs(x)
if sum>max1:max1=sum
if i==1or sum<min1:min1=sum print(max1,min1)
n=int(input("请输⼊n的值:"))
sum1=sum2=0.0
for i in range(1,4*n,4):
fz=1
fm=i*1.0
sum1=sum1+(fz/fm)
for i in range(3,4*n,4):
fz=1
fm=i*1.0
sum2=sum2+(fz/fm)
sum=float(sum1-sum2)
print("n的值是",(sum*4))
import math
i=1
sum=0
flag=1
num=(1/i)*flag
while abs(num)>=math.pow(10,-6): sum+=num
i+=2
flag=-flag
num=(1/i)*flag
print("n:%f"%(sum*4))
fz=2.0
fm=1.0
sum=0.0
for i in range(1,21):
s=(float)(fz/fm)
fz,fm=(fz+fm),fz
sum+=s
print(sum)
import math
for i in range(100,1000):
x=int(i/100)
y=int(i/10%10)
z=int(i%10)
if(i/9!=0):
shang=int(i/9)
if(shang==(x**2+y**2+z**2)):
print(i)
import math
for i in range(2,1001):
sum=0
for j in range(1,i):
if(i%j==0):
sum=sum+j
if(sum==i):
print(i)
sum=0
n=int(input("请输⼊n的值:"))
for i in range(1,n):
if i%2==0:
x=i/2
y=i**3
else:
x=i
y=i**2
z=x+y
数据库连接查询有几种sum+=z
print(sum)
for j in range(3,1001):
s=0
for i in range(1,j):
s+=1/i
if s-8>0and s-8<1e-17:
print(int(i))
sum=0
for i in range(1,2000):
sum+=1
while sum-8<1e-3and sum-8>0:
print(sum)
print(i)
break
sum=0
for i in range(1,2000):
sum+=1/i
while8-sum<1e-3and8-sum>0:
print(sum)
print(i)
break
m=0
for i in range(1,101):
n=0
for j in range(1,i):
if i%j==0:
n+=1
if n%2!=0:
max=i
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论