""" Write a program that randomly generates a 2d list of characters, make row and col also randomly generated and print the list. The program find the number of lowercase letters in 2d list and the number of uppercase letters in 2d list. The program creates one dimensional list that contains all lowercase letters and one dimensional list that contains all uppercase letters. """ import random def make_random2d_char(row, col, min, max): return [[(chr)(random.randint(min,max)) for i in range(col)] for j in range(row)] def print_matrix(list2d): for list in list2d: print(list) def main(): list2d=make_random2d_char(3,5,32, 126) print_matrix(list2d) print("solution 1") lowercase=[] uppercase=[] for list in list2d: for item in list: if(item.islower()): lowercase.append(item) elif(item.isupper()): uppercase.append(item) print("lowercase",lowercase, len(lowercase)) print("uppercase",uppercase, len(uppercase)) print("solution 2") lowercase=[] uppercase=[] row=len(list2d) col=len(list2d[0]) for i in range(row): for j in range(col): if(list2d[i][j].islower()): lowercase.append(list2d[i][j]) elif(list2d[i][j].isupper()): uppercase.append(list2d[i][j]) print("lowercase",lowercase, len(lowercase)) print("uppercase",uppercase, len(uppercase)) main()