
(图中方式获取Python学习必备基础知识100问及答案PDF电子完整版文件下载链接)
1.三元运算age = 10ticket = "儿童票" if age < 12 _______ "成人票"print(ticket)A. ? B. else:C. thenD. else2.输入函数trafficLight = ______("请输入信号灯颜色 red, green or yellow:")if trafficLight == "red": print("信号灯颜色是:" + trafficLight)elif trafficLight == "green": print("信号灯颜色是:" + trafficLight)else: print("信号灯颜色是:" + trafficLight)A. user_inputB. inputC. user_enterD. enter3.自定义函数返回值import mathr = float(input("请输入圆的半径:"))def circleArea(): ______ math.pi*pow(r, 2)print("圆的面积是:", circleArea())A. back B. sendC. returnD. param4.成员运算符color = {0:"red", 1:"yellow", 2:"green", 3:"white"}v = color.values()for c ______ v: print(c)A. inB. atC. onD. by5.检测字符串是否只由字母组成name = input("请输入你的英文昵称:") isLetter = name.______ if isLetter: print("有效的昵称!")else: print("无效的昵称!")A. isCharacter()B. isChar()C. isLetter() D. isalpha()6.文件操作f = ______("tryFile. txt", "w") f.write("I am learning Python programming ! ")f.closef = ______("tryFile. txt", "r") print(f.read())f.closeA. unwrapB. unlockC. untie D. open7.导入模块# program001.pydef red(): print("This flower is red")def yellow(): print("This flower is yellow")def green(): print("This flower is green")# program002.py______ program001# 导入模块program001.red()program001.yellow()program001.green()A. get B. importC. obtain D. acquire8.类参数class Flower: def __init__( ______, name, color ): self.name = name self.color = color f = Flower("rose", "red")print("The flower's name is " + f.name)print("The flower's color is " + f.color)A. thisB. whichC. selfD. object(图中方式获取Python学习必备基础知识100问及答案PDF电子完整版文件下载链接)

