From 55443275dbb9e732366853cedafc455327094d5a Mon Sep 17 00:00:00 2001 From: Rocish <41245916+Rocish@users.noreply.github.com> Date: Tue, 12 Feb 2019 20:21:02 +0530 Subject: [PATCH 1/5] Update Part-1-Functions --- Part-1-Functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Part-1-Functions b/Part-1-Functions index ba2c387..5aede3d 100644 --- a/Part-1-Functions +++ b/Part-1-Functions @@ -21,6 +21,15 @@ # arrayCheck([1, 1, 2, 1, 2, 3]) → True def arrayCheck(nums): + l=len(nums) + for i in range(l): + + if ((nums[i]==1) and (nums[i+1]==2) and (nums[i+2]==3)): + return print("True") + break + else: + i=i+1 + return print("False") # CODE GOES HERE From 15cf804dbf041b7b3a1012aa639598fecaec5e8c Mon Sep 17 00:00:00 2001 From: Rocish <41245916+Rocish@users.noreply.github.com> Date: Tue, 12 Feb 2019 20:31:18 +0530 Subject: [PATCH 2/5] Update Part-1-Functions --- Part-1-Functions | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Part-1-Functions b/Part-1-Functions index 5aede3d..9461f68 100644 --- a/Part-1-Functions +++ b/Part-1-Functions @@ -47,6 +47,9 @@ def arrayCheck(nums): # stringBits('Heeololeo') → 'Hello' def stringBits(str): + return print(str[::2]) + +stringBits(str) # CODE GOES HERE @@ -67,6 +70,21 @@ def stringBits(str): def end_other(a, b): +str1="Hiabc" +str2="abc" + +def endwith(str1,str2): + str1=str1.lower() + str2=str2.lower() + l=str2 + if str1.endswith(l): + print("True") + else: + print("False") + + +endwith(str1,str2) + # CODE GOES HERE ##################### @@ -81,6 +99,12 @@ def end_other(a, b): # doubleChar('Hi-There') → 'HHii--TThheerree' def doubleChar(str): + c = '' + for char in str: + c = c + char*2 + return print(c) + +double(str) # CODE GOES HERE @@ -124,3 +148,12 @@ def fix_teen(n): def count_evens(nums): # CODE GOES HERE + lst=[1,2,3,4,5,6,8,10] +count=0 +for i in lst: + if i%2==0: + + count=count+1 + else: + i=i+1 +print(count) From 5a970b5bac283fbdf9a6387cf0c887af7c17520b Mon Sep 17 00:00:00 2001 From: Rocish <41245916+Rocish@users.noreply.github.com> Date: Tue, 12 Feb 2019 20:47:18 +0530 Subject: [PATCH 3/5] Update Part-1-Functions --- Part-1-Functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Part-1-Functions b/Part-1-Functions index 9461f68..e3c46a0 100644 --- a/Part-1-Functions +++ b/Part-1-Functions @@ -22,7 +22,7 @@ def arrayCheck(nums): l=len(nums) - for i in range(l): + for i in range(l-2): if ((nums[i]==1) and (nums[i+1]==2) and (nums[i+2]==3)): return print("True") From 41e4687582b9032f739cd4ed31352077170a37f1 Mon Sep 17 00:00:00 2001 From: Rocish <41245916+Rocish@users.noreply.github.com> Date: Tue, 12 Feb 2019 20:53:16 +0530 Subject: [PATCH 4/5] Update Part-1-Functions --- Part-1-Functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Part-1-Functions b/Part-1-Functions index e3c46a0..82ea841 100644 --- a/Part-1-Functions +++ b/Part-1-Functions @@ -104,7 +104,7 @@ def doubleChar(str): c = c + char*2 return print(c) -double(str) +doubleChar(str) # CODE GOES HERE @@ -148,7 +148,6 @@ def fix_teen(n): def count_evens(nums): # CODE GOES HERE - lst=[1,2,3,4,5,6,8,10] count=0 for i in lst: if i%2==0: @@ -156,4 +155,5 @@ for i in lst: count=count+1 else: i=i+1 -print(count) +return count +count_evens(nums) From 20bc5f2a5eb751bd7083ec070befa766d99e5552 Mon Sep 17 00:00:00 2001 From: Rocish <41245916+Rocish@users.noreply.github.com> Date: Wed, 27 Feb 2019 23:45:40 +0530 Subject: [PATCH 5/5] Update Part-1-Functions --- Part-1-Functions | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Part-1-Functions b/Part-1-Functions index 82ea841..c946aeb 100644 --- a/Part-1-Functions +++ b/Part-1-Functions @@ -69,15 +69,16 @@ stringBits(str) # end_other('abc', 'abXabc') → True -def end_other(a, b): -str1="Hiabc" -str2="abc" + +str1="abc" +str2="Xaabc" def endwith(str1,str2): str1=str1.lower() str2=str2.lower() - l=str2 - if str1.endswith(l): + l1=str1 + l2=str2 + if str1.endswith(l2) or str2.endswith(l1): print("True") else: print("False") @@ -98,13 +99,13 @@ endwith(str1,str2) # doubleChar('AAbb') → 'AAAAbbbb' # doubleChar('Hi-There') → 'HHii--TThheerree' -def doubleChar(str): +def doubleChar(str1): c = '' - for char in str: + for char in str1: c = c + char*2 return print(c) -doubleChar(str) +doubleChar(str1) # CODE GOES HERE @@ -147,13 +148,10 @@ def fix_teen(n): # count_evens([1, 3, 5]) → 0 def count_evens(nums): - # CODE GOES HERE + count=0 -for i in lst: - if i%2==0: - +for i in nums: + if i%2==0: count=count+1 - else: - i=i+1 return count count_evens(nums)