Answers for "python not adding to list"

0

python not adding to list

main_list = []
second_list = []

def MyFunc():
    global main_list
    global second_list
    main_list = ['more', 'good', 'stuff']
    second_list = ['another', 'list']


MyFunc()

print(main_list) # ['more', 'good', 'stuff']
print(second_list) # ['another', 'list']
Posted by: Guest on December-10-2020

Python Answers by Framework

Browse Popular Code Answers by Language