######說明:答案僅提供參考
部分選擇題:
1、Python在記憶體中存盤了每個物件的參考計數(reference count),如果計數值變成0,關于相應的物件會發生變化,描述錯誤的是?(B)
A. 相應的物件消失
B. 相應的物件仍然存在
C. 分配給該物件的記憶體會釋放出來
D. 相應的物件占用的空間會移交給作業系統
2、在Unix系統中,以下關于可執行Python腳本檔案說法正確的是?(A)
A. 腳本檔案的模式必須是可執行的
B. 第一行必須以#(#!/usr/local/bin/python)開頭
C. 腳本檔案都可以直接執行
D. 以上說法都不正確
4、以下英文單詞中,不是Python保留字的是(A)
A. do
B. finally
C. with
D. in
8、以下哪個函式可以隨機化串列中的元素(C)
A. init
B. new
C. random
D. shuffle
10、以下哪個不是Python語言的標準庫(D)
A. datetime
B. random
C. sys
D. graph
13、在Python中,a=0011 1100,b=0000 1101,運算式a&b的結果是(A)
A. 0000 1100
B. 0011 1101
C. 0011 0001
D. 1100 0011
所有大題:

a,b = input().strip().split() count = 0 x_ = [-1,-1,-1] for i in range(int(a)+1,int(b)): if i*2 % 5 ==0: x_[count] = i count += 1 if count > 2: break print(x_[0],x_[1],x_[2])

a,b = input().split() x = list(map(int,input().split())) temp_max = x[0]*x[1]*x[2] temp_index = 0 for i in range(0,len(x)-2): v = x[i] * x[i + 1] * x[i + 2] if v > temp_max: temp_max = v temp_index = i print(temp_max,temp_index+1)

str1 = input() judge = "_1234.exe" count = 0 num_list = [] for i in range(0,len(str1)-len(judge)+1): if str1[i:i+len(judge)] == judge: count += 1 num_list.append(i) if count == 0: print(count) else: print(count,end=" ") for j in num_list: print(j,end=" ")

n = int(input().strip()) metrix = [] for i in range(n): metrix.append(list(map(int,input().strip().split()))) length = 0 I = -1 J = -1 tag = 0 for j in range(1,n-1): #遍歷每一行 temp_length = 0 temp_i = -1 temp_j = -1 for k in range(n): #遍歷每一列 if metrix[j][k] > metrix[j-1][k] and metrix[j][k] > metrix[j+1][k]: temp_length += 1 temp_i = j temp_j = k if temp_length > length: length = temp_length I = temp_i J = temp_j tag = 1 #標記更新 else: temp_length = 0 temp_i = -1 temp_j = -1 if tag == 1: J = J - length + 1 tag = 0 for j in range(1,n-1): #遍歷每一列 temp_length = 0 temp_i = -1 #代表行 temp_j = -1 #代表列 for k in range(n): #遍歷每一行 if metrix[k][j] > metrix[k][j-1] and metrix[k][j] > metrix[k][j+1]: temp_length += 1 temp_i = k temp_j = j if temp_length > length: length = temp_length I = temp_i J = temp_j tag = 1 else: temp_length = 0 temp_i = -1 temp_j = -1 if tag == 1: I = I - length + 1 tag = 0 if length == 0: print(0,-1,-1) else: print(length,I+1,J+1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/228781.html
標籤:其他
