FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonchallenge_code/lv_1/level_1.py at main · happylie/pythonchallenge_code · GitHub
happylie
/
pythonchallenge_code
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonchallenge_code
/
lv_1
/
level_1.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (33 loc) · 1.16 KB
Breadcrumbs
pythonchallenge_code
/
lv_1
/
level_1.py
Copy path
File metadata and controls
40 lines (33 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
# alphabet = "abcdefghijklmnopqrstuvwxyz"
# change_alphabet = "cdefghijklmnopqrstuvwxyzab"
# Step 2
# K -> M : 2
# O -> Q : 2
# E -> G : 2
def
ascii_to_char
(
origin_text
):
result
=
""
for
i
in
origin_text
:
if
i
==
" "
or
i
==
"."
or
i
==
"'"
or
i
==
"("
or
i
==
")"
:
result
+=
i
else
:
if
ord
(
i
)
+
2
==
123
:
result
+=
chr
(
97
)
elif
ord
(
i
)
+
2
==
124
:
result
+=
chr
(
98
)
else
:
result
+=
chr
(
ord
(
i
)
+
2
)
return
result
def
answer
(
origin_text
):
alphabet
=
"abcdefghijklmnopqrstuvwxyz"
change_alphabet
=
"cdefghijklmnopqrstuvwxyzab"
trans_text
=
origin_text
.
maketrans
(
alphabet
,
change_alphabet
)
result
=
origin_text
.
translate
(
trans_text
)
return
result
if
__name__
==
"__main__"
:
text_str
=
"g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
html_str
=
"map.html"
uri_str
=
"map"
print
(
ascii_to_char
(
html_str
))
print
(
answer
(
uri_str
))
Back
|
FazBrowse Home
|
New Git URL