#扫描文件
import os
def saomiao(wenjian):
for i in os.listdir(wenjian):
i1=os.path.join(wenjian,i)
if os.path.isfile(i1):
print(os.path.abspath(i1))
elif os.path.isdir(i1):
saomiao(i1)
else:
pass
saomiao("D:\\ak")
#回文素数
def sushu(num):
for i in range(2,num):
if num % i == 0:
break
else:
return num
def huiwenshu(num):
ls = []
if str(num) == str(num)[::-1]:
ls.append(num)
return ls
num = 2
ls = []
while len(ls)<100:
if sushu(num) and huiwenshu(num):
ls.append(num)
num +=1
print(ls)
# 制作一个可以计算三角形面积的函数
def isValid(side1, side2, side3):
if side1 + side2 >= side3 and side2 + side3 >= side1 and side3 + side1 >= side2:
num = [side1, side2, side3]
for i in range(0, -1):
for j in range(0, len(num) - 1):
if num[j] >= num[j + 1]:
num[j], num[j + 1] = num[j + 1], num[j]
a = num[0]
b = num[1]
print("Theareaofthetrianglei:", a * b / 2)
else:
print("Input isinvalid")
a, b, c = eval(input("请填写三角形的三个边的长度用逗号隔开"))
isValid(a, b, c)
标签:python,i1,num,ls,side2,side3,side1 From: https://www.cnblogs.com/Aa112233/p/17724327.html