From 6999235858a749aaff17c90b5dabe3159c656ec4 Mon Sep 17 00:00:00 2001 From: Anant Prasad Date: Sun, 28 Oct 2018 01:15:41 +0530 Subject: [PATCH 1/4] Exercism hammer question solution --- hammer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 hammer.py diff --git a/hammer.py b/hammer.py new file mode 100644 index 0000000..ecf5b41 --- /dev/null +++ b/hammer.py @@ -0,0 +1,11 @@ +class hammer(object): + def dna(self,str1,str2): + self.str1=str1 + self.str2=str2 + j=0 + c=0 + for i in str1: + if i!=self.str2[j]: + c+=1 + j+=1 + print c From a6c02e1224f93850581f30538ba6d8eeedb8ef9a Mon Sep 17 00:00:00 2001 From: Anant Prasad Date: Sun, 28 Oct 2018 01:19:22 +0530 Subject: [PATCH 2/4] Exercism panagram solution --- pangram.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pangram.py diff --git a/pangram.py b/pangram.py new file mode 100644 index 0000000..935994c --- /dev/null +++ b/pangram.py @@ -0,0 +1,19 @@ +class pangram: + c=0 + flag=0 + def __str__(self,str): + self.str=str + self.check=self.def_pangram() + print self.check + def def_pangram(self): + for i in range(65,91): + for j in self.str: + if self.flag==0: + if (i==ord(j) or i+32==ord(j)): + self.flag+=1 + self.c+=1 + self.flag=0 + if self.c==26: + return "True" + else: + return "False" From 1cd3dae5cfa0ff6a28641d79638b9f565b8595b6 Mon Sep 17 00:00:00 2001 From: Anant Prasad Date: Sun, 28 Oct 2018 01:20:57 +0530 Subject: [PATCH 3/4] Exercism anagram solution --- ana.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ana.py diff --git a/ana.py b/ana.py new file mode 100644 index 0000000..4812fac --- /dev/null +++ b/ana.py @@ -0,0 +1,20 @@ +def count(): + s=input("Enter length ") + p=raw_input("enter word") + f=0 + flag=0 + l=[] + l=[] + for i in range(s): + st=raw_input("enter the word") + l.append(st) + print l + for i in l: + for j in range(len(i)): + for f in range(len(p)): + if i[j]==p[f]: + flag+=1 + if flag==len(p): + print i + flag=0 +count() From b57e196646888551362bb8c37ce56e580fdbfba3 Mon Sep 17 00:00:00 2001 From: Anant Prasad Date: Sun, 28 Oct 2018 01:22:13 +0530 Subject: [PATCH 4/4] Added bob.py --- bob.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bob.py diff --git a/bob.py b/bob.py new file mode 100644 index 0000000..3acc03b --- /dev/null +++ b/bob.py @@ -0,0 +1,14 @@ +# +# Skeleton file for the Python "Bob" exercise. +# +def hey(what): + if what[len(what)-1]=='?': + return "Sure" + elif len(str)>3: + for i in range(len(what)-1): + if what[i]=='!': + return 'Whoa, chill out!' + else: + return 'Whatever' + elif (what=='Bob'): + return 'Fine, Be that way!'