在Python中,乘号使用星号 `*` 表示。以下是一些示例:
1. 定义两个数并计算它们的乘积:
```python
num1 = 5
num2 = 6
product = num1 * num2
print(product) 输出:30
2. 使用星号 `*` 作为重复操作符,在列表中重复元素:
```python
print(a) 输出:['0', '0', '0', '0', '0']
3. 使用星号 `*` 接受任意数量的参数:
```python
def demo(*p):
print(p)
demo(1, 2, 3) 输出:(1, 2, 3)
希望这些示例能帮助你理解Python中乘号的用法