Respuesta :
Answer:
see explaination
Explanation:
Program source code below:
def displayNumbers():
string = ""
num = 0
#first loop to control 5 rows
for i in range(5):
#second loop to control columns
for j in range(5):
str1 = str(num)
# str1.ljust(5) function to left justify output string
#appending number in resulting string
string = string + str1.ljust(5)
#updating num for next iteration
num = num + 1
#new line after each row to display pattern correctly
string = string + "\n"
return string
def pattern():
string = ""
num = 0
#first loop to control 1-4 rows
for i in range(5):
#In second loop to control 5 columns
for j in range(5):
str1 = str(num)
if num == 2:
num = num -2
else :
num = num + 1
# str1.ljust(5) function to left justify output string
string = string + str1.ljust(5)
# new line after each row to display pattern correctly
string = string + "\n"
return string
#Function calls
print('\033[4m')
print('\033[1m{}\033[0m'.format('Output 1:\n'))
print(displayNumbers())
print('\033[4m')
print('\u0332\033[1m{}\033[0m'.format('Output 2:\new'))
print(pattern())
See attachment for sample output and screenshot.
Nb: Always refer to screenshot if there is an indentation error.
![Ver imagen kendrich](https://us-static.z-dn.net/files/d38/06b3535daebd88b1c69ae29456cff1fb.png)
![Ver imagen kendrich](https://us-static.z-dn.net/files/d69/c466d84cfbe68937d40783b402b6f3e1.png)
![Ver imagen kendrich](https://us-static.z-dn.net/files/d87/97c86f5cde12c779f1b24dfad0a99d3f.png)