The title
A square can be formed from two equilateral right triangles. Given the side lengths of the square, the symbols used for the two triangles and the diagonals, print out the square formed by the two triangles.
Input format: Input a positive integer L (2≤L≤100, square side length) in a line, and the characters used to print the upper triangle, the lower triangle, and the diagonal. Digits and characters are separated by a space.
Output format: Print the square formed by the two triangles as required by the input.
Example: 6 A b- No blank line at the end Example: - AAAAA b- AAAA BB - AAA BBB - AA BBBB -a BBBBB - No blank line at the endCopy the code
Their thinking
L,a,b,f = map(str,input().split())
# L,a,b,f = map(str,"6 a b -".split())
L = int(L)
for i in range(L):
left = i
right = L-i-1
mid = i+1
print(b*left + f + a*right)
Copy the code