Commit e6e7e362 by BellCodeEditor

auto save

parent adaf6f8a
Showing with 23 additions and 8 deletions
import random
# a=12.3456191
# print('%.4f' % a)#%格式化输出,.4代表小数 %对谁格式化
# # a1=round(a,3)
# # print(a1)
# # #切片法
alist = []
for i in range(1, 101):
alist.append(i)
num = random.choice(alist)
# 请完善二分查找函数binary_search(),查找出num在列表alist里面的索引位置
# price = 52
# # txt = "The price is {} dollars"
# txt = "The price is {:.2f} dollars"
# print(txt.format(price))
def binary_search(alist,num):
\ No newline at end of file
for i in range(2,101):
for j in range (2,i):
if i%j == 0:
break
else:
print(i)
for i in range(2,101):
a=1
for j in range (2,i):
if i%j == 0:
a=0
if a==1:
print(i)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment