TDT4109/Exercise 6/7.py

11 lines
298 B
Python
Raw Normal View History

2020-10-12 17:23:02 +02:00
def separate(numbers, threshold):
return(
[num for num in numbers if num < threshold],
[num for num in numbers if num >= threshold],
)
def multiplication_table(n):
return [[(x+1)*(y+1) for x in range(n)] for y in range(n)]
if __name__ == "__main__":
print(multiplication_table(4))