python基础考试题库及答案.docVIP

  • 1
  • 0
  • 约3.05千字
  • 约 12页
  • 2026-08-26 发布于甘肃
  • 举报

python基础考试题库及答案

一、单项选择题(总共10题,每题2分)

1.在Python中,哪个关键字用于定义一个函数?

A.function

B.def

C.define

D.func

答案:B

2.下列哪个不是Python的内置数据类型?

A.list

B.dictionary

C.array

D.tuple

答案:C

3.如何在Python中创建一个空列表?

A.[]

B.{}

C.()

D.None

答案:A

4.下列哪个操作符用于检查一个元素是否存在于列表中?

A.==

B.in

C.contains

D.is

答案:B

5.在Python中,如何删除字典中的一个键值对?

A.deldict[key]

B.removedict[key]

C.deletedict[key]

D.alloftheabove

答案:A

6.下列哪个是Python中的迭代器?

A.list

B.set

C.tuple

D.alloftheabove

答案:D

7.在Python中,如何将字符串转换为小写?

A.lower()

B.tolower()

C.convertToLower()

D.alloftheabove

答案:A

8.下列哪个是Python中的异常处理关键字?

A.try

B.

文档评论(0)

1亿VIP精品文档

相关文档