I am new to python. I have query regarding un-hardcoding object names(if condition) in python script. I have fruit = [ Apple, Mango, Pineapple, Banana, Oranges] and size = [ small, medium , big] Currently I write code as below:
if (fruit == apple, size == small):
statement 1
statement 2
elif (fruit == apple, size == medium):
statement 1
statement 2
elif (fruit == apple, size == big):
statement 1
statement 2
elif (fruit == Mango, size == small):
statement 1
statement 2
elif (fruit == Mango, size = medium):
statement 1
statement 2
How can I avoid writing multiple if...else conditions?
Statement 1: Pulling up a dot file related to fruit and size from directory The path structure is main-directory/fruit/collateral/fruit_size.dot statement 2: Pulling up a txt file related to fruit and size from directory The path structure is main-directory/source/readparamters/readparam/fruit_size.txt
I want to execute statements for each condition one at a time. Currently I take inputs for fruit and size from user. Is there a way in python that the script can automatically take combinations one by one and execute statements? I know it's somewhat complex and python expert can help me.