of upper base of triangle = "))print("Hollow InvertedRight Triangle Star Pattern") for i in range(1, r + 1): if i%2 == 0: print() continue for j in range(1, 2*r): if (i == 1 and not j%2 == 0) or i == j or i + j == r*2: print('*', end = '') else...
"Python" # string to # first programstring = '.' * (length - 1) + wordfor i in range(length - 1): print(string[i:i + length])# second programfor i in range(1, length): _str = word[:i] + '.' * (length - i) print(_str[::-1] + _str) 输出为: ...P...Py...P...
Hollow right-angled triangle pattern l = 5 for x in range(l): if x == l - 1 or x == 0: print('*' * (x + 1)) else: print('*' + ' ' * (x - 1) + '*') We tried to add multiple programs in each category. Here are additional patterns for the next set of categori...
r = int(input("Length of upper base of triangle = "))print("Hollow Inverted Right Triangle Star Pattern") for i in range(1, r + 1): if i%2 == 0: print() continue for j in range(1, 2*r): if (i == 1 and not j%2 == 0) or i == j or i + j == r*2: print...
r = int(input("Length of upper base of triangle = "))print("Hollow Inverted Right Triangle Star Pattern") for i in range(1, r + 1): if i%2 == 0: print() continue for j in range(1, 2*r): if (i == 1 and not j%2 == 0) or i == j or i + j == r*2: print...
r = int(input("Length of upper base of triangle = "))print("Hollow Inverted Right Triangle Star Pattern") for i in range(1, r + 1): if i%2 == 0: print() continue for j in range(1, 2*r): if (i == 1 and not j%2 == 0) or i == j or i + j == r*2: print...