更多课程 选择中心


Python培训

400-111-8989

python培训基础测试,一测便知是否入门!

  • 发布:Python那些事
  • 来源:柠檬班软件测试
  • 时间:2018-06-20 16:37

在进行python培训学习的过程中,有的同学说,老师我学习python这么久了,入门了吗?我的python基础怎么样,你能考考我吗?应广大学子的要求,今天带给大家一份python培训基础测试,看下你是否能够选择或者作答出正确答案。

python培训基础测试一

下面代码中func1(a)的结果是:

def func1(a):

sums = sum(map(lambda x: x + 1, a[-3:]))

return sums

a = [1,2,3,5,4,1,5]

func1(a)

A 9

B 13

C 10

python培训基础测试二

有如下两个列表:

list1 = [(2),(0),(1),(8) ]

list2 = [(2,),(0,),(1,),(8,)]

那么,type(list1[0])和type(list2[0])分别是:

A int tuple

B int int

C tuple tuple

python培训基础测试三

下面代码中func2(a)的结果是:

def func2(a):

b = {}

b = b.fromkeys(a)

return (len(b.keys()))

a = [1,2,4,2,4,1,6,5,2,3,1]

print (func2(a))

A 11

B 6

C 5

python培训基础测试四

定义如下的字符串和列表:

a = 'I love PythonSomething!'

b = 'I love PythonSomething!'

c = [1, 2, 3]

d = [1, 2, 3]

那么,a is b和c is d的结果分别是:

A False True

B True True

C True False

python培训基础测试五

下面代码的输出结果为:

import copy

a = [2,[0,1],8]

b = copy.copy(a)

a[1].append(3)

print(b)

c = copy.deepcopy(a)

a[1].append(4)

print (c)

A [2, [0, 1, 3], 8]

[2, [0, 1, 3], 8]

B [2, [0, 1, 3], 8]

[2, [0, 1, 4], 8]

C [2, [0, 1, 4], 8]

[2, [0, 1, 4], 8]

python培训基础测试六

下面代码中f3的输出结果为:

def append_list(val, list=[]):

list.append(val)

return list

f1 = append_list(1)

f2 = append_list(2, [])

f3 = append_list('Python')

A [1, 'Python']

B ['Python']

C [1, 2, 'Python']

python培训基础测试七

下面代码中 func3() + func4()的结果为:

x = 10

def func3():

x = 3

return x**2

def func4():

return x + 5

func3() + func4()

A 24

B 21

C 115

python培训基础测试八

下面代码中stu2.score的结果为:

class Student:

score = []

stu1 = Student()

stu2 = Student()

stu1.score.append(99)

stu1.score.append(96)

stu2.score.append(98)

A [99, 96, 98]

B [98]

C [99, 98]

python培训基础测试九

二分查找是非常经典的算法。已经有如下定义,请完善代码,实现二分查找算法:

def binary_search(list, item):

'''

:param list: 列表

:param item: 要查找的元素

:return: item在list中的索引,若不在list中返回None

'''

python培训基础测试十

爬虫是Python的一大应用方向。请通过Python抓取猫眼电影或者豆瓣电影评分前100的电影信息。

恭喜你阅读完了本文,相信此刻你已经作答出了这些题目,感觉怎么样了?这些题目都会做吗?目测能过关吗?如果你有不会的,欢迎你来达内python培训机构进行咨询。

免责声明:内容和图片源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

预约申请免费试听课

填写下面表单即可预约申请免费试听! 怕学不会?助教全程陪读,随时解惑!担心就业?一地学习,可全国推荐就业!

上一篇:了解这些常用的python工具与资源,让python培训学习更有效!
下一篇:python已经加入到全国计算机等级二级考试了,你知道吗?

达内python培训机构就业喜报,用事实告诉你月薪过万不是梦!

python资讯|招聘AI人才开出4000万年薪,真的值吗?

你想自学python语言,因为它是黑客语言?

未来有两种人,会Python的和不懂Python的小学生?

  • 扫码领取资料

    回复关键字:视频资料

    免费领取 达内课程视频学习资料

Copyright © 2023 Tedu.cn All Rights Reserved 京ICP备08000853号-56 京公网安备 11010802029508号 达内时代科技集团有限公司 版权所有

选择城市和中心
黑龙江省

吉林省

河北省

湖南省

贵州省

云南省

广西省

海南省