I'm currently creating a Python application to calculate financial statement ratios and am having notational issues with making a flexible variable based on user input.
First, the program establishes acceptable stock ticker inputs and creates variables for 2 companies' annual revenues:
validStockTickers = ['FSLR', 'JKS']
RMB_USD_conversion_factor = 6406572060 / 40826521106
revenue_2019_FSLR = 3063117 * 1000
revenue_2019_JKS = 29746287759 * RMB_USD_conversion_factor
Then the program asks the user which stock ticker the user wants to learn more about:
companyStockInput = input("Which company do you want to learn more about? (Enter stock ticker)")
if companyStockInput in validStockTickers:
print("Stock Ticker: ",companyStockInput,'\n',
'\n',
"Revenues:",'\n',
"2019 Total Revenue: " + revenue_2019_FSLR
Where I'm having issues is making the revenue_2019_FSLR be flexible based on the user input. So if the user types in JKS at the user prompt, the variable in the last line of my code would be revenue_2019_JKS, etc.