Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1-homework-yanjun
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bonnieyan
1-homework-yanjun
Commits
554dc04b
Commit
554dc04b
authored
Jan 10, 2019
by
yanjun13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交第三次作业摩斯密码
parent
f37222ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
3-homework-yanjun/mosimm.py
+23
-0
No files found.
3-homework-yanjun/mosimm.py
0 → 100644
View file @
554dc04b
words
=
[
"gin"
,
"zen"
,
"gig"
,
"msg"
]
mima
=
{
"a"
:
".-"
,
"b"
:
"-..."
,
"c"
:
"-.-."
,
"d"
:
"-.."
,
"e"
:
"."
,
"f"
:
"..-."
,
"g"
:
"--."
,
"h"
:
"...."
,
"i"
:
".."
,
"j"
:
".---"
,
"k"
:
"-.-"
,
"l"
:
".-.."
,
"m"
:
"--"
,
"n"
:
"-."
,
"o"
:
"---"
,
"p"
:
".--."
,
"q"
:
"--.-"
,
"r"
:
".-."
,
"s"
:
"..."
,
"t"
:
"-"
,
"u"
:
"..-"
,
"v"
:
"...-"
,
"w"
:
".--"
,
"x"
:
"-..-"
,
"y"
:
"-.--"
,
"z"
:
"--.."
}
word
=
""
s
=
""
list_code
=
[]
count
=
0
#外层循环获取字符gin
for
i
in
words
:
#内层循环获取字母对应的摩斯密码
for
j
in
i
:
word
+=
mima
[
j
]
#将对应字符gin的摩斯密码组合放入s
s
=
word
if
s
not
in
list_code
:
count
+=
1
#将不一样的摩斯密码组合放入list_code
list_code
.
append
(
s
)
#清空组合的摩斯密码以便外层循环存放新的摩斯密码
word
=
""
print
(
count
)
print
(
list_code
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment