diff --git a/hw1-1.py b/hw1-1.py new file mode 100644 index 0000000..0a755a8 --- /dev/null +++ b/hw1-1.py @@ -0,0 +1,2 @@ +input = input().split() +print(sum([float(n) for n in input])) diff --git a/hw1-2.py b/hw1-2.py new file mode 100644 index 0000000..1adea44 --- /dev/null +++ b/hw1-2.py @@ -0,0 +1,20 @@ +string = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" +string2 = "WHY THE HELL DO I NEED WHILE TRUE HERE" +def replacement(stcringe): + while True: + print(stcringe.replace('A', '4')) + print(stcringe.replace('I', '1')) + print(stcringe.replace('E', '3')) + break + +replacement(string) +replacement(string2) + +# okay check this +replacements = {'A': '4', + 'I': '1', + 'E': '3'} +for letter in replacements: + while letter in string: + string = string[:string.find(letter)] + replacements[letter] + string[string.find(letter) + 1:] + print(string) diff --git a/hw1-3.py b/hw1-3.py new file mode 100644 index 0000000..0aeb3b4 --- /dev/null +++ b/hw1-3.py @@ -0,0 +1,2 @@ +input = input().split() +print([int((float(n) * float(n)) ** 0.5) for n in input]) \ No newline at end of file diff --git a/hw1-4.py b/hw1-4.py new file mode 100644 index 0000000..bfd682d --- /dev/null +++ b/hw1-4.py @@ -0,0 +1,2 @@ +input = input().split() +print(sum(float(n) ** 2 for n in input)) \ No newline at end of file diff --git a/hw1-5.py b/hw1-5.py new file mode 100644 index 0000000..0990e52 --- /dev/null +++ b/hw1-5.py @@ -0,0 +1,9 @@ +def ceaserCipher(str, key): + new_str = '' + for el in str: + new_str = new_str + chr(((ord(el) - 97 + key) % 26) + 97) + return(new_str) + +print(ceaserCipher('i am atomic', 7)) +print(ceaserCipher('i am atomic', 1024)) +print(ceaserCipher('abcdefghijklmnopqrstuvwxyz', 27)) \ No newline at end of file