From a4b7dfd8851da111b74b2f2572f7a8594ee79c5f Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 18 Feb 2023 08:51:19 +0800 Subject: [PATCH] save project --- my_search.py | 31 ++++++------------------------- test.py | 3 +++ 2 files changed, 9 insertions(+), 25 deletions(-) create mode 100644 test.py diff --git a/my_search.py b/my_search.py index 4903aca..2de665a 100644 --- a/my_search.py +++ b/my_search.py @@ -1,28 +1,9 @@ -import random - -alist = [] -for i in range(1, 101): - alist.append(i) -num = random.choice(alist) -# 请完善二分查找函数binary_search(),查找出num在列表alist里面的索引位置 - -def binary_search(alist,num): - low = 0 - high = len(alist)-1 - while low <= high: - mid = (low + high) // 2 - guess = alist[mid] - if guess == num: - return mid - elif guess < num: - low = mid + 1 - else: - high = mid - 1 - return None - -result = binary_search(alist, num) -print("老师给的数是", num) -print("它在列表里的索引是: ", result) +words = {"Chinese":"中文", "English":"英语", "French":"法语", "Korean":"韩语"} +del words["French"] + + + +print(len(words)) diff --git a/test.py b/test.py new file mode 100644 index 0000000..d8d70da --- /dev/null +++ b/test.py @@ -0,0 +1,3 @@ +filel=open(r'C:\\Users\\Administrator\\Desktop\\test.txt','w',encoding='utf-8') +filel.write('小兰:12本') +filel.close() \ No newline at end of file -- libgit2 0.25.0