Python入学考试难题核心(附答案).docVIP

  • 0
  • 0
  • 约2.77千字
  • 约 10页
  • 2026-10-21 发布于四川
  • 举报

Python入学考试难题核心(附答案)

单项选择题(每题2分,共20分)

1.以下哪个是Python的合法标识符?

A.2myvar

B.my-var

C._myvar

D.myvar

答案:C

2.Python中用于创建函数的关键字是?

A.function

B.def

C.create

D.make

答案:B

3.以下哪种数据类型在Python中是不可变的?

A.列表

B.字典

C.元组

D.集合

答案:C

4.执行以下代码后,x的值是:

```python

x=[1,2,3]

y=x

y[0]=100

```

A.[1,2,3]

B.[100,2,3]

C.[1,100,3]

D.报错

答案:B

5.Python中,以下哪个不是循环语句?

A.for

B.while

C.do-while

D.以上都不是

答案:C

6.要从字符串hello中提取e,可以使用:

A.hello[0]

B.hello[1]

C.hello[2]

D.hello[-1]

答案:B

7.以下哪个函数用于将字符串转换为整数?

A.str()

B.float()

C.int()

D.list()

答案:C

8.以下代码的输出结果是:

```python

print(23)

```

A.

文档评论(0)

1亿VIP精品文档

相关文档