Use Url class in 1

This commit is contained in:
Stephan Porada 2021-10-31 00:04:23 +02:00
parent 66203a72cf
commit 0efa8136a2

View File

@ -1,6 +1,5 @@
import string import string
from utils.Url import Url
URL = 'http://www.pythonchallenge.com/pc/def/map.html'
SECRET = ("g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq " SECRET = ("g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq "
"ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw " "ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw "
@ -27,13 +26,11 @@ def shift_chars(riddle_string, shift_by_int):
def main(): def main():
shifted_secret = shift_chars(SECRET, 2) shifted_secret = shift_chars(SECRET, 2)
print('Shifted secret:', shifted_secret) print(shifted_secret)
shifted_url = shift_chars(URL, 2) shifted_url = shift_chars('map', 2)
print('Shifted url:', shifted_url) builder = Url()
new_url = URL.replace('map', shifted_url.split('/')[-1][:3]) builder.solution = shifted_url
print('New url:', new_url) print(builder.url)
if __name__ == '__main__': if __name__ == '__main__':