lundi 6 juillet 2020

Picking specific character and setting it into a var

I am trying to make a program that turns specific characters into numbers.. for example setting a to 51251 and b to 75414 and if you type 'ab' you get = 5125175414 I tried this:

a = '742461'
b = '634146'
c = '634174'
answer = '0'
en = input("Here:  ").lower()
while True:
    if en == 'a':
        answer1 = answer + a
        print("a")
    elif en == 'b':
        answer1 = answer + a 


    elif en == 'c':
        answer1 = answer + a
    
    elif en == 'done':
        print(f"{answer1}")
        
    else: 
        print("error")

But it doesn't work at all :/. You guys have any ideas ?

Aucun commentaire:

Enregistrer un commentaire