Python計算機二級考試程式題(試卷五)

2021-10-09 19:39:13 字數 2769 閱讀 9580

# 請在______處使用一行**替換

## 注意:請不要修改其他已給出**

s =eval

(input

("請輸入乙個數字:"))

ls =[0

]for i in

range(65

,91):

chr(i)

)print

("輸出大寫字母:{}"

.format

(ls[s]))

# 請在______處使用一行**或表示式替換

## 注意:請不要修改其他已給出**

s =input

("請輸入乙個十進位制數:"

)num =

int(s)

print

("轉換成二進位制數是:"

.format

(num)

)# 請在______處使用一行**或表示式替換

## 注意:請不要修改其他已給出**

import jieba

s =input

("請輸入乙個中文字串,包含標點符號:"

)m =jieba.lcut(s)

print

("中文詞語數:{}"

.format

(len

(m))

)# 請在______處使用一行**或表示式替換

## 注意:請不要修改其他已給出**

import turtle

turtle.color(

"red"

,"yellow"

)turtle.begin_fill(

)for i in

range(36

):turtle.fd(

200)

turtle.left(

170)

turtle.end_fill(

)# 以下**為提示框架

# 請在...處使用一行或多行**替換

# 請在______處使用一行**替換

## 注意:提示框架**可以任意修改,以完成程式功能為準

fo =

open

("py202.txt"

,"w"

)def

prime

(num)

:for i in

range(2

,num)

:if num%i==0:

return

false

return

true

#此處可以是多行**

ls =[51

,33,54

,56,67

,88,431

,111

,141,72

,45,2

,78,13

,15,5

,69]lis =

for i in ls:

if prime(i)

==false

:#此處為一行**

fo.write(

">>>{},列表長度為{}"

.format

(lis,

len(lis)))

fo.close(

)# 以下**為提示框架

# 請在...處使用一行或多行**替換

# 請在______處使用一行**替換

## 注意:提示框架**可以任意修改,以完成程式功能為準

fi=open

("arrogant.txt"

,"r"

)fo=

open

("py301-1.txt"

,"w"

)txt=fi.read(

).strip(

"\n"

)d =

for i in txt:

d[i]

=d.get(i,0)

+1ls =

list

(d.items())

for i in

range

(len

(ls)):

fo.write(

"{}:{}\n"

.format

(ls[i][0

],ls[i][1

]))fo.close(

)fi.close(

)# 以下**為提示框架

# 請在...處使用一行或多行**替換

# 請在______處使用一行**替換

## 注意:提示框架**可以任意修改,以完成程式功能為準

fi=open

("arrogant.txt"

,"r"

)fo=

open

("arrogant-sort.txt"

,"w"

)txt=fi.read(

).strip(

"\n"

)d =

for i in txt:

d[i]

=d.get(i,0)

+1ls =

list

(d.items())

ls.sort(key=

lambda x:x[1]

,reverse=

true

)for i in

range(10

):fo.write(

"{}:{}\n"

.format

(ls[i][0

],ls[i][1

]))fo.close(

)fi.close(

)

計算機考試二級

計算機二級是全國計算機等級考試 nationalcomputerrankexamination,簡稱ncre 四個等級中的乙個等級,是經原國家教育委員會 現教育部 批准,由教育部考試中心主辦的用於考查應試人員計算機應用知識與技能的全國性計算機水平考試。計算機二級考試不僅考核計算機基礎知識,還有計算機...

Python計算機二級考試程式題(試卷一)

請在 處使用一行 或表示式替換 注意 請不要修改其他已給出 s input 請輸入乙個字串 print format s 請在 處使用一行 或表示式替換 注意 請不要修改其他已給出 a,b 0,1while a 50 print a,end a,b b,a b 請在 處使用一行 或表示式替換 注意 ...

python計算機二級考試大題總結

1.賣火柴的小女孩 2.節假日讀入 csv檔案處理 3.論語 文章處理 4.感測器索引 5.傲慢與偏見 文章處理 6.成績統計 csv檔案處理 7.類8.凱撒密碼 9.詩詞轉換 10.猜字母遊戲 答題思路 開啟檔案 讀取檔案內容 定義字典,統計字元數量 轉化字典為列表方便排序 進行排序 寫如檔案 關...