<jupyter_start><jupyter_text>Excercise: Create a program that inputs a list, and converts it to a lower-triangular matrix with the ith element in the list as the ith column elements of the lower-triangular matrix. matrix = matrix, n = number of columns = number of rows (square matrix), a = list<jupyter_code>def convert_to_matrix(a, n):
    matrix = [[0 for col in range(n)] for row in range(n)]
    for i in range(n):
        for j in range(n):
            if i >= j:
                matrix[i][j] = a[j]
    for i in range(n):
        for j in range(n):
            print(matrix[i][j], end="\t")
        print()
def create_new_list():
    global a, n
    a = []
    n = int(input("\nEnter the number of digit-elements of the list: "))
    print("Enter your", n, "digit-numbers one by one")
    for i in range(n):
        a.append(int(input(f"Enter you element {i+1}: ")))
def main():
    while True:
        print("\n=================== MAIN MENU ===================")
        print("1. Enter a (new) list")
        print("2. Convert list to a left-diagonal matrix")
        print("3. Quit")
        print("=================================================\n")

        choice = int(input("Enter your choice: "))
        if choice not in [1, 2, 3]:
            print("\nInvalid Input")
        elif choice == 1:
            create_new_list()
        elif choice == 2:
            convert_to_matrix(a, n)
        else:
            print("End of program")
            break
main()<jupyter_output>=================== MAIN MENU ===================
1. Enter a (new) list
2. Convert list to a left-diagonal matrix
3. Quit
=================================================

Enter your choice: 1

Enter the number of digit-elements of the list: 7
Enter your 7 digit-numbers one by one
Enter you element 1: 3
Enter you element 2: 5
Enter you element 3: 3
Enter you element 4: 6
Enter you element 5: 4
Enter you element 6: 6
Enter you element 7: 2

=================== MAIN MENU ===================
1. Enter a (new) list
2. Convert list to a left-diagonal matrix
3. Quit
=================================================

Enter your choice: 2
3	0	0	0	0	0	0	
3	5	0	0	0	0	0	
3	5	3	0	0	0	0	
3	5	3	6	0	0	0	
3	5	3	6	4	0	0	
3	5	3	6	4	6	0	
3	5	3	6	4	6	2	

=================== MAIN MENU ===================
1. Enter a (new) list
2. Convert list to a left-diagonal matrix
3. Quit
=================================================

Enter your choice: 3
End of program
{'fraction_non_alphanumeric': 0.22784810126582278, 'fraction_numerical': 0.035524703960800326, 'mean_word_length': 2.8341158059467917, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '291521', 'license': 'Unlicense', 'n_tokens_mistral': 811, 'n_tokens_neox': 761, 'n_words': 323, 'path': 'Convert List to Lower Triangular Matrix.ipynb', 'repo_name': 'Parv-Joshi/School-Python-Codes', 'size': '2449'}