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
8 changes: 8 additions & 0 deletions answer1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
lst = input()

l = [1, 2, 3, 4, 5]
def rotate(l, n):
return l[-n:] + l[:-n]

print(rotate(l, -2))
print(rotate(l, 2))
11 changes: 11 additions & 0 deletions answer2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import collections

sentence = input("type a sentence: ")


sentence = sentence.lower()
sentence = sentence.replace(" ","")

print(collections.Counter(sentence))


27 changes: 27 additions & 0 deletions answer3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#collecting inputs:
word1 = set(input("type any word: ").lower())
word2 = set(input("type another word: ").lower())

#shared letters as a sorted string
common = sorted(set(word1 & word2))
incommon_str = ''.join (list (map (str, common)))

#Letters unique to word 1 as a sorted string:
unique_to1 = sorted(set(word1 - word2))
unique1 = ''.join (list (map (str, unique_to1)))

#Letters unique to word 2 as a sorted string:
uinque_to2 = sorted(set(word2 - word1))
unique2 = ''.join (list (map (str, uinque_to2)))

#creating a list of the above strings
lst = []
lst += [incommon_str]
lst +=[unique1]
lst +=[unique2]

# extracting the requested output:
print("the output is:" + str(lst))