I know the desired syntax lies in the first function but I for the life of me can't find where it is.
I've attempted to remove commas and add spaces to each .split()
each has yielded an undesired return value.
def get_country_codes(prices):
price_list = prices.split(',')
results = ''
for price in price_list:
results += price.split('$')[0]
return results
def main():
prices = "US$40, AU$89, JP$200"
price_result = get_country_codes(prices)
print(price_result)
if __name__ == "__main__":
main()
The current output:
US AU JP
The desired output:
US, AU, JP