I am designing a game in python. Lets say i have 5 levels and a variable m. if i am on level 1, m will be 101 if i am on level 2, m will be 102 and so on
Now, i also have a variables for best score for all levels, lets say b_101,b_102,b_103,b_104,b_105. All initially set to 0.
Now while playing i have a variable current_score. I want to update best score on meeting some condition.
if(condition met):
   global m
   update_score(m)
def update_score(m):
    if(m==101):
        b_101=current_score
    elif(m==102):
        b_102=current_score
    elif(m==103):
        b_103=current_score
    elif(m==104):
        b_104=current_score
    elif(m==105):
        b_105=current_score
Now in actual, i may have 100 levels and i want my update_score function to be small and not write 100 if else lines.
I want it be be something like:
def update_score(m):
    b_{m}=current_score
I know above code in incorrect, but i want something b_xxx to be updated on basis of m. Is it possible in python.
In perl, it can be done
${'b_'.$m} = $current_score;
 
     
    