用python编写程序,打印九九乘法表。要求输出九九乘法表的各种显示效果(上三角、下三角、
时间: 2024-05-05 10:18:18 浏览: 85
Python用for循环实现九九乘法表
正三角等等)。
Sure, here's the Python code to print the times table:
```python
for i in range(1, 10):
for j in range(1, i + 1):
print(str(i) + " x " + str(j) + " = " + str(i * j), end="\t")
print()
```
To print different display effects, you can use different formatting techniques in the print statement. For example, to print an upper triangle:
```python
for i in range(1, 10):
for j in range(i, 10):
print(str(i) + " x " + str(j) + " = " + str(i * j), end="\t")
print()
```
Hope that helps!
阅读全文