Update Lesson 2 Task %*f#ncA0#>? to use maketrans
This commit is contained in:
parent
56d867314f
commit
507ad1caff
1 changed files with 3 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
# Return codes:
|
# Return codes:
|
||||||
# 0 - OK
|
# 0 - OK
|
||||||
|
|
||||||
import codecs
|
rot13 = str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
|
||||||
|
'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm')
|
||||||
|
|
||||||
print(codecs.encode(input("Enter message: "), "rot13"))
|
print(input("Enter message: ").translate(rot13))
|
||||||
|
|
Reference in a new issue