python中type(12.34)_Python期末复习题(必考)(最新整理)

《Python期末复习题(必考)(最新整理)》由会员分享,可在线阅读,更多相关《Python期末复习题(必考)(最新整理)(7页珍藏版)》请在人人文库网上搜索。

1、2018-2019 学年第一学期 python 练习专业、班级:学号:姓名: Python 语言基础一、单选题1. 在 Python 中,合法的标识符是 【】。A. _B. 3CC. itsD. str2. Python 表达式中,可以使用【】控制运算的优先顺序。A.圆括号()B.方括号C.花括号D.尖括号B. C. D. 2. Python 语句 x=Python;y=2;print(x+y)的输出结果是【】。A.语法错B. 2C. Python2D. PythonPython 3. Python 表达式 sqrt(36)*sqrt(81)的值为【】。A. 54.0B. 2916.0C.9.。

2、0D.6.04. Python 语句 print(chr(65)的运行结果是【】。A. 65B. 6C. 5D. A5. 关于 Python 字符串,下列说法错误的是【】。A. 字符即长度为 1 的字符串B. 字符串以 0 标志字符串的结束C. 既可以用单引号,也可以用双引号创建字符串D. 在三引号字符串中可以包含换行回车等特殊字符6. 下列表达式的值为 True 的是【】。A. 322B. 2!=5 or 0C.5=20: print(x/10)elif 0B. C. D. 2.Python 语句 print(type(1,2,3,4)的结果是【】。A.B. C. D. 3.a=1,2,3,。

3、None,(),; print(len(a)的输出结果是【】。A.4B. 5C. 6D. 74.Python 语句 s1=4,5,6; s2=s1; s11=0; print(s2)的运行结果是【】。A.4,5,6B.0,5,6C. 4,0,6D. 以上都不对5.Python 语句 a=1,2,3,None,(),; print(len(a)的运行结果是【】。A.语法错B.4C.5D.66.在 Python 中, 设有 s=a,b,则语句序列s.append(1,2);s.insert(1,7);执行后,s 值为 【】。A. a, 7, b, 1, 2B. 1, 2, 7, a,bC. 1, 。

4、2,a,7,bD. a, 7, b,1, 2二、填空题1. Python 语句 fruits=apple, banana, pear; print(fruits-1-1)的结果是。2. Python 语句 fruits=apple, banana, pear; print(fruits.index(apple)的结果是。3. Python 语句 fruits=apple, banana, pear; print(Apple in fruits)的结果是。4. Python 语句 print(sum(range(10)的结果是。5. Python 语句 print(%d%d%(3/2, 3%2)。

5、的结果是。6. Pyhon 语句 s=1,2,3,4;s.append(5,6,7);print(s)的运行结果是,print(len(s)的运行结果是。7. Python 语句 s=1, 2, 3, 4; s2=5,6,7;print(len(s1+s2)的运行结果是。8. Python 语句设 s=abcdefg,则 s:-1的值是。9. Python 语句 print(tuple(1,2,3),list(1,2,3)的运行结果是。10. 下列程序运行后,在键盘输入apple and peach,则程序运行结果是。str=input(请输入一串字符串:)flag=0 count=0for 。

6、c in str:if c= :flag=0 else:if flag=0:flag=1 count=count+1print(count)函数一、单选题1. Python 语句f=lambda x,y;x*y;f(12,34)的程序运行结果是【】。A.12B. 22C.56D. 4082. Python 语句 f1=lambda x:x*3;f2=lambda x:x*2; print(f1(f2(3)的程序运行结果是【】。A.3B. 6C.9D.183. 下列 Python 语句的输出结果是【】。counter=0; num=0 def TestVariable():global coun。

7、terfor i in range(4):counter+=1 num=5TestVariable() print(counter, num)A. 4 0B. 4 10C. 7 0D. 7 10二、填空题1. Python 表达式 eval(5/2+5%2+5/2)的结果是。2. 如果要为定义在函数外的全局变量赋值,可以使用语句,表明变量是在外面定义的全局变量。三、思考题1. 写出下面程序的执行结果。d=lambda p:p*2 t=lambda p:p*3x=2 x=d(x)x=t(x) print(x)2. 写出下面程序的执行结果。x=30def func():global x x=20f。

8、unc() print(x)文件一、填空题1. Python 可以使用函数打开文件。2. 文件操作可以使用方法关闭流,以释放资源。3. 当已存在一个 abc.txt 文件时,该语句myfile=open(abc.txt,w)的功能是。二、思考题1. 使用 open()函数时,指定打开文件的模式 mode 有哪几种?其默认打开模式是什么?2. 对文本文件的读有哪些方法,写有哪些方法?3. 以下程序实现从文件“moon.txt”读出前 5 个字符,并输出。myfile=open(moon.txt,r)s=#读取 5 个字符print(s)#关闭文件“”“”At the end, Xiao Bian。

9、 gives you a passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuo。

10、us learning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值