2023年9月电子学会青少年软件编程(Python五级)等级考试试卷
客观题
五级
2023
2023-10-17 14:27:30
44次
一、单选题
回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。下面可以正确打印三位回文数的语句是?( )
| A. print(i for i in range(100,999) if str(i) == str(i)[::-1]) |
B. print([i for i in range(1,1000) if str(i) == str(i)[::-1]]) |
| C. print([i for i in range(1,999) if str(i) == str(i)[::-1]]) |
D. print([i for i in range(100,1000) if str(i) == str(i)[::-1]]) |
【知识点】 电子学会Python五级
阅读以下代码,程序输出结果正确的选项是?( )
def process_keywords(keywords_list): unique_keywords = list(set(keywords_list)) sorted_keywords = sorted(unique_keywords) result = tuple(sorted_keywords) return result keywords = ["节约能源", "循环利用", "清洁能源", "减少污染", "植树造林","清洁能源"] print(process_keywords(keywords))
| A. ('节约能约', '循环利用', '减少污染', '清洁能源', '减少污染') |
B. ('循环利用', '植树造林', '减少污染', '清洁能源', '清洁能源') |
| C. ('减少污染', '循环利用', '植树造林', '清洁能源', '节约能源') |
D. ('植树造林', '循环利用', '节约能源', '清洁能源', '节约能源') |
【知识点】 电子学会Python五级
