Mar-12-2020, 06:21 PM
money = int(input("How much money do you want to convert: ")) not_quit = True while not_quit == True: money_data = [] print("The available coins you can convert your money into are: 100p, 50p, 20p, 10p, 5p, 2p, 1p") # Enter only a whole integer here without the "P" coin = int(input("What coin do you want your money to be converted into: ")) amount = int(input( "How much of this money do you wish to be converted to the coin you have selected: ")) number_of_coins = amount // coin money -= amount # I added a string within a string as I could not concatenate the string with the integer variable "coin" unless there is a way around this money_data.append([number_of_coins, [coin, "p"]]) want_to_exit = input( "You have {} amount of money left to convert. Do you want to leave? Enter yes to leave, enter no to continue.".format(money)) want_to_exit = want_to_exit.upper() if want_to_exit == "NO": not_quit = True elif want_to_exit == "YES": not_quit = False print("You have {}").format(money_data)AttributeError: 'NoneType' object has no attribute 'format'
My first question is whether money_data[] keeps adding new indexes to its list, and it isn't overwriting itself (keeps adding new information)
My second question is whether we can print lists by using the .format function in the last line of this code.
Thanks