#define number of stars
numStars = 6
#define function - takes a number of stars and prints an upside-down triangle
def printTriangle():
printTriangle(numStars)
Complete the function printTriangle(). the function is incomplete. print a triangle of stars. output is:
******
*****
****
***
**
*
__________________________
#define list of numbers
numbersList = [4, 12, 35, 13, 8, 13, 0, 2, 13, 13, 56]
def removeUnlucky():
print("Unlucky: ",numbersList
)removeUnlucky(numbersList
)print("Lucky: ", numbersList)
Complete the function removeUnlucky(). the program will not run because the function is incomplete. remove every instance of the number 13 from the list. output is:
Unlucky: [4, 12, 35, 13, 8, 13, 0, 2, 13, 13, 56]
Lucky: [4, 12, 35, 8, 0, 2, 56]
Code:
#define number of stars
numStars = 6
#define function - takes a number of stars and prints an upside-down triangle
def printTriangle(n):
for i in range(0, n):
for j in range(i, n):
print('*', end = '')
print()
printTriangle(numStars)
Screenshots:
Get Answers For Free
Most questions answered within 1 hours.