File tree 1 file changed +60
-0
lines changed
1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ import random
2
+
3
+ random .random ()
4
+
5
+ cho = input ("want code or decode message:-" )
6
+ if cho == "code" :
7
+ try :
8
+ a = input ("Enter a message:-" )
9
+ except :
10
+ if len (a ) < 2 :
11
+ raise ValueError ("len should atleast 3 cher" )
12
+
13
+ if len (a ) >= 2 :
14
+ b = a [1 :] + a [0 ]
15
+ c = [
16
+ "srk" ,
17
+ "joj" ,
18
+ "yup" ,
19
+ "kok" ,
20
+ "uri" ,
21
+ "xyz" ,
22
+ "jio" ,
23
+ "pok" ,
24
+ "lmn" ,
25
+ "qwe" ,
26
+ "ert" ,
27
+ "frt" ,
28
+ ]
29
+ d = [
30
+ "fop" ,
31
+ "zip" ,
32
+ "mop" ,
33
+ "kai" ,
34
+ "sip" ,
35
+ "uih" ,
36
+ "jui" ,
37
+ "zyx" ,
38
+ "qrs" ,
39
+ "frg" ,
40
+ "khi" ,
41
+ "wer" ,
42
+ ]
43
+ e = random .choice (c )
44
+ f = random .choice (d )
45
+ g = e + b + f
46
+ h = g .split ()
47
+ print ("Your coded message is:- " , g )
48
+
49
+ elif cho == "decode" :
50
+ a1 = input ("Enter a code word " )
51
+ if len (a1 ) < 2 :
52
+ b2 = a1 .split ()
53
+ print ("Your Decode word are:-" , b2 )
54
+ else :
55
+ c1 = a1 [3 :- 3 ]
56
+ d1 = c1 [- 1 ] + c1 [:- 1 ]
57
+ print (d1 )
58
+ else :
59
+ raise ValueError ("Invalid choice and input, pleasecorrect them!!" )
60
+
You can’t perform that action at this time.
0 commit comments