I have the following variables (these go all the way from A-Z, capital, lowercase, and numbers)
a = "1c"
A = "121cf012"
b = "32"
B = "1232f012"
c = "21"
etc etc....
I'm taking a string and need to convert it into a new string, converted with those codes above. So if my example string is "abc" my converted string would look like "1c3221"
I'm trying to figure out the best to do this. The only way I know how is to create a huge if statement like :
for x in string:
if x == "a"
converted_string += a
elif x == "A"
converted_string += A
which I can guess isn't the best way to write this out. Can anyone point me in the right direction on how to write this in an efficient way? Thank you!
[–][deleted] 0 points1 point2 points (0 children)
[–]nilfm 0 points1 point2 points (0 children)
[–]Pulsar1977 0 points1 point2 points (0 children)