-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
128 lines (99 loc) · 3.68 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# QUESTION:
# Change normal english language to a unique laguage that include numbers and symbols and also special characters.
# Like: A --> 4 and a --> @
# SOLUTION:
# uniqueL() function for the conversion of normal characters to special characters.
def uniqueL():
# Tell user how to quit.
print("""Press "q" to quit\n""")
# While loop for running script repeatedly.
while True:
# Take normal text from user.
text = input("Type some thing: ")
# O variable is to store unique characters
O = ""
# If text is equal to "q" then break the loop.
if text == "q":
break
# For loop for getting each character of text variable.
for chr in text:
# Using switch statement for matching a characters and convert them into unique characters.
match chr:
# If chr is "A" then replace it with "4".
case "A":
O = O + chr.replace("A", "4")
# If chr is "a" then replace it with "@".
case "a":
O = O + chr.replace("a", "@")
# If chr is "B" then replace it with "8".
case "B":
O = O + chr.replace("B", "8")
# If chr is "b" then replace it with "6".
case "b":
O = O + chr.replace("b", "6")
# If chr is "C" then replace it with "(".
case "C":
O = O + chr.replace("C", "(")
# If chr is "c" then replace it with "(".
case "c":
O = O + chr.replace("c", "(")
# If chr is "E" then replace it with "3".
case "E":
O = O + chr.replace("E", "3")
# If chr is "g" then replace it with "9".
case "g":
O = O + chr.replace("g", "9")
# If chr is "H" then replace it with "#".
case "H":
O = O + chr.replace("H", "#")
# If chr is "I" then replace it with "1".
case "I":
O = O + chr.replace("I", "1")
# If chr is "i" then replace it with "!".
case "i":
O = O + chr.replace("i", "!")
# If chr is "n" then replace it with "π".
case "n":
O = O + chr.replace("n", "π")
# If chr is "O" then replace it with "0".
case "O":
O = O + chr.replace("O", "0")
# If chr is "o" then replace it with "⊖".
case "o":
O = O + chr.replace("o", "⊖")
# If chr is "r" then replace it with "τ".
case "r":
O = O + chr.replace("r", "τ")
# If chr is "S" then replace it with "5".
case "S":
O = O + chr.replace("S", "5")
# If chr is "s" then replace it with "$".
case "s":
O = O + chr.replace("s", "$")
# If chr is "T" then replace it with "7".
case "T":
O = O + chr.replace("T", "7")
# If chr is "u" then replace it with "μ".
case "u":
O = O + chr.replace("u", "μ")
# If chr is "X" then replace it with "%".
case "X":
O = O + chr.replace("X", "%")
# If chr is "x" then replace it with "×".
case "x":
O = O + chr.replace("x", "×")
# If chr is "Z" then replace it with "2".
case "Z":
O = O + chr.replace("Z", "2")
# If chr is "z" then replace it with "2".
case "z":
O = O + chr.replace("z", "2")
# If above case are not matched then run default case and add character as it is.
case _ :
O = O + chr
# Print unique language.
print(O)
# If running file name is "__main__" then execute below code.
if __name__ == "__main__" :
# Run uniqueL() function.
uniqueL()