帮我用python代码实现利用数组使两个数相加
时间: 2023-02-08 14:56:43 浏览: 130
```python
# 使用数组实现两个数相加
numbers = [1, 2]
result = sum(numbers)
print(result) # 输出结果为3
```
或者
```python
numbers = [1, 2]
result = numbers[0] + numbers[1]
print(result) #输出结果为3
```
或者
```python
a = 1
b = 2
result = a + b
print(result) #输出结果为3
```
阅读全文