I am trying to use this function to get user input in creating a dict object that I can use to generate a .json file and the function works right up until you type done it does realize that you typed done and it does display the variable you are creating as its being added on to but when you try to return it it always outputs 'None'. I am using the latest version of python. Me and my teacher have no idea why it doesn't work.
def menu_asset_create_lang(lang):
# The functions "header, space, and br"
# are all just for making the text look nice in
# the command line all they do is print stuff for
# formatting and clear just does os.system('cls')
clear()
header()
print('Lang Creation: ')
space()
print(lang)
br()
print('< Done')
inp1 = labeled_input('Input Lang Code')
if(inp1 == 'done') or (inp1 == '<'):
return lang
inp2 = labeled_input('Input Translation')
lang.append(inp1 + '\":\"' + inp2)
menu_asset_create_lang(lang)
# instantiate the variable
lang = []
# feed it into the function and make it
# spit out the generated variable in console
print(menu_asset_create_lang(lang))
also I have tried doing this:
lang = []
langout = menu_asset_create_lang(lang)
print(langout)
Also please understand that I am pretty new to python.