Python中輸出由三角形組成的三角形?
pattern = input("請輸入你要選擇的模式:") while True: if pattern == "A": row = eval(input("請輸入行數:")) for i in range(1, row + 1): for j in range(1, i+1): print(j, end=" ") print("") elif pattern == "B": row = eval(input("請輸入行數:")) for i in range(1, row + 1): for j in range(1, row - i + 2): print(j, end=" ") print("")
上一篇和python區別
下一篇組織激活服務如何連接