我正在进行函数和参数练习:
Write a function that will print out a "diamond" of any size and with any symbol specified by the user. The size is the width of the diamond. Test it.
我试着在网上搜索我的问题的答案,但是所有的答案都有用户输入的行数,这不是我想要的。到目前为止,我的代码是令人满意的。有什么帮助吗
userSize = int(input("Enter size: "))
userSymbol = input("Enter symbol: ")
def drawCross(symbol, size):
num = 0
for i in range(1, size + 1):
for j in range(1, (size - i) + 1):
print(end=" ")
drawCross(userSymbol, userSize)
目前没有回答
相关问题 更多 >
编程相关推荐