PROBLEM SET
题库
按难度与知识点筛选,找到适合的练习题。
题目列表
共 67434 题
A26815
在Python中, readlines() 方法返回的文件内容包含每行末尾的换行符( \n )。( )
Python-L4
较难
--
A26816
执行下面Python代码后,将只输出 try 。( )def test(): try: return "try" finally: print("finally执行了") print(test())
Python-L4
较难
--
A26817
执行下面Python代码后,输出的结果为 [1, 4, 9] 。( )print(list(map(lambda x: x**2, [1, 2, 3])))
Python-L4
较难
--
A26818
执行下面Python代码会报错,因为lambda函数不能有默认参数。( )f = lambda x, y=2: x + yf(1)
Python-L4
较难
--
A26819
执行下面Python代码后,输出的结果为3。( )data = {'ids': [1, 2], 'name': 'test'} data['ids'].extend(['g', 'e', 's', 'p']) print(len(data['ids']))
Python-L4
较难
--
A26820
现在,人们参加各种闭卷考试时通常都不允许将智能手机、平板电脑等带入考场,因为智能手表通常都有嵌入操作系统及通信等功能,所以也不允许携带入考场。( )
Python-L4
较难
--
A26821
给定一个整数数组 nums ,计算其最长递增子序列的长度。子序列可以不连续,但必须保持原数组的顺序。例如: nums = [10, 9, 2, 5, 3, 7, 101, 18] 的最长递增子序列是 [2, 3, 7, 101] ,长度为 4。( )def length_of_LIS(nums): dp = [1] * len(nums) # dp[i] 表示以 nums[i] 结尾的最长递增子…
Python-L4
较难
--
A26822
执行以下代码后,输出的结果是?( )data = ['apple', 'Banana', 'cherry']print(sorted(data))
Python-L4
较难
--
A26823
以下哪种排序算法的时间复杂度在最坏情况下是 ?( )
Python-L4
较难
--
A26824
以下哪种文件打开模式可以在不截断文件的情况下同时支持读写?( )
Python-L4
较难
--
A26825
以下哪个选项可以正确读取文件"data.txt"的全部内容并返回一个字符串?( )with open("data.txt", "r") as f: content = ________
Python-L4
较难
--
A26826
执行下面Python代码后,输出的结果是?( )try: 1/0 except ValueError: print("A") else: print("B") print("c")
Python-L4
较难
--
A26827
执行下面Python代码后,会发生什么?( )try: raise ValueError except Exception: print("A") except ValueError: print("B")
Python-L4
较难
--
A26828
执行下面Python代码后,输出的结果是?( )def apply(func, x): return func(x) def square(n): return n * n result = apply(square, 4) print(result)
Python-L4
较难
--
A26829
执行下面Python代码后,输出的结果是?( )func = lambda x: x * 2 if x > 0 else x // 2print(func(-4), func(4))
Python-L4
较难
--
A26830
执行下面Python代码后,输出的结果是?( )x = 10 def func(): x += 1 return x print(func())
Python-L4
较难
--
A26831
以下哪个函数调用是合法的?( )def func(a, b, *, c, d=0): pass
Python-L4
较难
--
A26832
执行下面Python代码后,输出的结果是?( )def func(*args): return sum(args) / len(args) result = func(1, 2, 3, 4, 5) print(result)
Python-L4
较难
--
A26833
执行下面Python代码后,输出的结果是?( )s1 = {('a', 1), ('b', 2)} s2 = {('b', 2), ('a', 1)} t1 = (('a', 1), ('b', 2)) t2 = (('b', 2), ('a', 1)) print(s1 == s2, t1 == t2)
Python-L4
较难
--
A26836
最大公因数
Python-L5
困难
--