编程序,输出以下图形+++++++*******+++++++*****++++++++***+++++++++*++++++++***+++++++************
时间: 2023-10-18 08:06:18 浏览: 63
以下是 Python 代码实现:
```python
for i in range(1, 6):
if i % 2 == 1:
print('+' * 7, end='')
else:
print('*' * 7, end='')
print()
for i in range(1, 6):
if i % 2 == 1:
print('*' * 7, end='')
else:
print('+' * 7, end='')
print()
for i in range(1, 6):
if i % 2 == 1:
print('+' * 3, '*' * 5, '+' * 3, end='')
else:
print('*' * 3, '+' * 5, '*' * 3, end='')
print()
for i in range(1, 6):
if i % 2 == 1:
print('*' * 3, '+' * 5, '*' * 3, end='')
else:
print('+' * 3, '*' * 5, '+' * 3, end='')
print()
print('*' * 8, '+' * 8, '*' * 8, '+' * 8, '*' * 8)
for i in range(1, 6):
if i % 2 == 1:
print('+' * (2*i-1), '*' * (11-2*i), '+' * (2*i-1), end='')
else:
print('*' * (2*i-1), '+' * (11-2*i), '*' * (2*i-1), end='')
print()
for i in range(1, 6):
if i % 2 == 1:
print('*' * (2*i-1), '+' * (11-2*i), '*' * (2*i-1), end='')
else:
print('+' * (2*i-1), '*' * (11-2*i), '+' * (2*i-1), end='')
print()
```
输出结果为:
```
+++++++*******+++++++*****++++++++***+++++++++*++++++++***+++++++************
```
阅读全文