Untitled

mail@pastecode.io avatar
unknown
python
a year ago
325 B
0
Indexable
Never
str = input("Input string: ")
offset = int(input("Input offset number: "))

result = ''
for c in str:
	result = result + (chr(ord(c) + offset) if c.isalpha() else c)
print("Result classic: ", result)

result_symbols = [chr(ord(c) + offset) if c.isalpha() else c for c in str]
print("Result modern: ", ''.join(result_symbols))