Home > other >  Could you tell me how to solve the following problems?
Could you tell me how to solve the following problems?

Time:11-30

In order to improve the security of the data, letters can be encrypted into digital preservation, when using, Numbers back into letters again, subject letters (' a ', 'b', 'c', 'd', 'e', 'f', 'g'), the corresponding,8,7,6,5,4,3 [9], please programming to achieve the following functions: keyboard input, the output digital cipher, unable to convert characters with "*" alternative output,

CodePudding user response:

To compare

CodePudding user response:

So!!!!
 list_1=[' a ', 'b', 'c', 'd', 'e', 'f', 'g'] 
List_2=,8,7,6,5,4,3 [9]
Dict_1={}
For I in range (len (list_1) :
Dict_1 [list_1 [I]]=STR (list_2 [I])

Str_1=input (" please enter the encrypted string: ')
Str_1=[dict_1 [j] if j in dict_1 keys () else '*' for j [I for I in str_1]] in
Str_2='
For I in str_1:
Str_2 +=I
Print (str_2)

CodePudding user response:

refer to the second floor il_ perserve _li reply:
this!!!!
 list_1=[' a ', 'b', 'c', 'd', 'e', 'f', 'g'] 
List_2=,8,7,6,5,4,3 [9]
Dict_1={}
For I in range (len (list_1) :
Dict_1 [list_1 [I]]=STR (list_2 [I])

Str_1=input (" please enter the encrypted string: ')
Str_1=[dict_1 [j] if j in dict_1 keys () else '*' for j [I for I in str_1]] in
Str_2='
For I in str_1:
Str_2 +=I
Print (str_2)


Thank you for your help

CodePudding user response:

refer to the second floor il_ perserve _li reply:
this!!!!
 list_1=[' a ', 'b', 'c', 'd', 'e', 'f', 'g'] 
List_2=,8,7,6,5,4,3 [9]
Dict_1={}
For I in range (len (list_1) :
Dict_1 [list_1 [I]]=STR (list_2 [I])

Str_1=input (" please enter the encrypted string: ')
Str_1=[dict_1 [j] if j in dict_1 keys () else '*' for j [I for I in str_1]] in
Str_2='
For I in str_1:
Str_2 +=I
Print (str_2)


Thank you for your help

CodePudding user response:

 s='ash' 
List_1=[' a ', 'b', 'c', 'd', 'e', 'f', 'g']
List_2=[9, 8, 7, 6, 5, 4, 3)

Print ('. Join ([dict (zip (list_1, map (STR, list_2))), get (_, '*') for _ in s]))

CodePudding user response:

Thank you!!!
  • Related