I have designed this code below which basically takes as an input, the number of rows, columns,highest value and lowest value from the user.
import random
import math
nrows=int(input("enter the number of rows: "))
ncols=int(input("enter the number of columns: "))
lowval=float(input("enter the lowest value: "))
highval=float(input("enter the highest value: "))
def list(nrows, ncols, lowval, highval):
values=[[0, 0, 0, 0],[0, 0, 0, 0],[0, 0, 0, 0]]
for r in range(nrows):
for c in range(ncols):
values[r][c] = random.uniform(lowval,highval+1)
print(values)
list(nrows, ncols, lowval, highval)
Now the area which I'm struggling with is attempting to take the list and convert it into something more organized akin to a chart so that the output basically mirrors this for example:
Number of rows: 4
Number of columns: 3
Low value: -100
High value: 100
0 1 2
0 7.715 6.522 23.359
1 79.955 -4.858 -71.112
2 49.249 -17.001 22.338
3 98.593 -28.473 -92.926
Any suggestions/ideas as to how I can have my output look like the one desired above?