马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
18.0def add_X(*adds, base=3):
return sum(adds)*base
list1=[1,2,3,4,5,6,7,8]
print(add_X(*list1,base=8))
18.1def shuixianhua():
for i in range(100,1000):
sum = 0
t=i
while t:
sum+=(t%10)**3
t=t//10
if sum ==i:
print (sum)
i+=1
shuixianhua()
18.2str1 = input ('请输入字符串:')
searched = input ('请输入要查询的字符串:')
def search(inta,intb):
searchid=0
start = 0
result=0
if intb not in inta:
print ('meiyou')
else:
while 1:
searchid = inta.find(intb,start)
if not searchid == -1:
result += 1
start = searchid +2
else:
print ('字符串出现了',result,'次')
break
search(str1, searched)
|