This is in python language.
I need to print this pattern, depending on the number of lines a user enters:
‘##’
‘# #’
The next pattern is three spaces away and so on…
This is my code but it prints the second number sign on a different line. I need them to go on the same line.
def drawPatternIII (lines):
for i in range(lines):
for j in range(1):
print('#')
for j in range(i+1):
print (' ', end = '')
print ('#')
please help!
You would need to add
end=""to the firstprint()call. While you are at it, remove the pointless for loop with a single iteration.A concise alternative would be