Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hw1-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input = input().split()
print(sum([float(n) for n in input]))
20 changes: 20 additions & 0 deletions hw1-2.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions hw1-3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input = input().split()
print([int((float(n) * float(n)) ** 0.5) for n in input])
2 changes: 2 additions & 0 deletions hw1-4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input = input().split()
print(sum(float(n) ** 2 for n in input))
9 changes: 9 additions & 0 deletions hw1-5.py
Original file line number Diff line number Diff line change
@@ -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))