<aside> ๐ก Kmodule 1.0 ์ ๋ฐ์ดํธ ๋ด์ญ
</aside>
import random
def descending(x):
a = x.copy()
b = []
for i in range(len(a)):
b.append(max(a))
a.remove(max(a))
return b
def ascending(x):
a = x.copy()
b = []
for i in range(len(a)):
b.append(min(a))
a.remove(min(a))
return b
def fac(x):
n = 1
for i in range(1, x+1):
n *= i
return n
def reversenum(a):
a1 = a
return int(str(a1)[::-1])
def mos(a):
wordlist = ['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', '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', ' ', ',', '.', '?', ';', ':', '/', '-',
"'", '(', ')', '@']
codelist = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....',
'..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.',
'--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-',
'-.--', '--..', '-----', '.----', '..---', '...--', '....-',
'.....', '-....', '--...', '---..', '----.','/', '--..--',
'.-.-.-', '..--..', '-.-.-', '---...', '-..-.', '-....-',
'.----.', '-.--.', '-.--.-', '.--.-.']
x = list(a.lower())
y = len(x)
for i in range(y):
print(codelist[wordlist.index(x[i])], end = ' ')
<aside> ๐ก 2023/9/28
</aside>