From 281318be2b18a9566d25e5c5e1a93a9ae68c00ba Mon Sep 17 00:00:00 2001 From: lysteria27 <90513751+lysteria27@users.noreply.github.com> Date: Wed, 24 Nov 2021 07:01:51 +0530 Subject: [PATCH 1/2] perfect sq --- perfect_square.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 perfect_square.py diff --git a/perfect_square.py b/perfect_square.py new file mode 100644 index 0000000..cee8bd0 --- /dev/null +++ b/perfect_square.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Sep 26 18:39:44 2021 + +@author: deyas +""" + +def is_square(n): + ans=0 + while ans**2 Date: Wed, 24 Nov 2021 08:35:34 +0530 Subject: [PATCH 2/2] cipher text --- cipher.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cipher.py diff --git a/cipher.py b/cipher.py new file mode 100644 index 0000000..b8495a4 --- /dev/null +++ b/cipher.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +""" +Created on Mon Oct 25 16:36:54 2021 + +@author: deyasini +""" + +def cipher(map_from, map_to, code): + """ map_from, map_to: strings where each contain + N unique lowercase letters. + code: string (assume it only contains letters also in map_from) + Returns a tuple of (key_code, decoded). + key_code is a dictionary with N keys mapping str to str where + each key is a letter in map_from at index i and the corresponding + value is the letter in map_to at index i. + decoded is a string that contains the decoded version + of code using the key_code mapping. """ + key_code={} + i=0 + d=[] + for char in map_from: + key_code[char]=map_to[i] + i+=1 + + for char in code: + d.append(key_code[char]) + decoded=''.join(d) + return (key_code, decoded) \ No newline at end of file