蓝桥杯python语言2021年第一次stema真题答案.docxVIP

  • 1
  • 0
  • 约小于1千字
  • 约 3页
  • 2024-03-01 发布于浙江
  • 举报

蓝桥杯python语言2021年第一次stema真题答案.docx

蓝桥杯python语言2021年第一次stema真题答案

2021年蓝桥杯Python语言第一次stema真题答案

1.**第一题**:编程题

```python

defmerge_lists(list1,list2):

merged_list=[]

foriinrange(max(len(list1),len(list2))):

ifilen(list1):

merged_list.append(list1[i])

ifilen(list2):

merged_list.append(list2[i])

returnmerged_list

list1=[1,3,5]

list2=[2,4,6,8]

result=merge_lists(list1,list2)

print(result)

```

答案:[1,2,3,4,5,6,8]

2.**第二题**:编程题

```python

deffind_max_sum_subarray(arr):

max_sum=arr[0]

current_sum=arr[0]

foriinrange(1,len(arr)):

文档评论(0)

1亿VIP精品文档

相关文档