Oct-25-2016, 05:00 AM
Hello Friends,
I would like to get my list to print out horizontally and have spaces in between on a new line like this:
10 15 25 30
25 30 45 60
81 92 81
The last line does not need to be separated evenly like the other two. The user is able to enter in any amount.
Here is the code:
Thank you in advance! =)
I would like to get my list to print out horizontally and have spaces in between on a new line like this:
10 15 25 30
25 30 45 60
81 92 81
The last line does not need to be separated evenly like the other two. The user is able to enter in any amount.
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
def Grades(amount): import random for i in range ( 0 , amount): empty_list = [] grade_list = amount * empty_list comb_list = grade_list.append(random.randint( 0 , 100 )) print (grade_list) #str_create = str(Grades(5)) #print(len(str_create)) def Rows(grade_list): grade_list_string = str (Grades( 10 )) for i in range ( 0 , len (grade_list_string)): pos_slice = grade_list_string[ 0 : 2 ] print (pos_slice) Rows( 1 ) |
Thank you in advance! =)