I want to make a pyramid but there is a new line after every for loop. This is worked example 12.01 in the CAIE A-Level Textbook.
maxnumber = 2
numberofspaces = 0
numberofsymbols = 1
# Set values
symbol = input("Enter a symbol.\n")
while maxnumber % 2 == 0:
maxnumber = int(input("Enter the number of symbols you want in the base.\n"))
numberofspaces = int((maxnumber - 1) / 2)
while numberofsymbols <= maxnumber:
for space in range(numberofspaces):
print(" ")
for i in range(numberofsymbols):
print(symbol)
print("\n")
numberofsymbols += 2
numberofspaces -= 1
Expected results-
$
$$$
$$$$$
Actual results-
$
$
$
$
$
$
$
$
$