They gave me a pattern coding question. given a=5, b=3 the pattern should be printed in this way. * *** ***** *** *
Anónimo
a = 5 b = 3 width = 1 while width <= a: spaces = (a - width) // 2 print(" " * spaces + "*" * width) if width == b: width = a else: width += 2 width = b while width >= 1: spaces = (a - width) // 2 print(" " * spaces + "*" * width) width -= 2