-
Notifications
You must be signed in to change notification settings - Fork 7
trying pull request #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,15 @@ | |
| # arrayCheck([1, 1, 2, 1, 2, 3]) → True | ||
|
|
||
| def arrayCheck(nums): | ||
| l=len(nums) | ||
| for i in range(l-2): | ||
|
|
||
| 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") | ||
Tushar-OP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # CODE GOES HERE | ||
|
|
||
|
|
||
|
|
@@ -38,6 +47,9 @@ def arrayCheck(nums): | |
| # stringBits('Heeololeo') → 'Hello' | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct |
||
| def stringBits(str): | ||
| return print(str[::2]) | ||
|
|
||
| stringBits(str) | ||
| # CODE GOES HERE | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct |
||
|
|
||
|
|
||
|
|
@@ -57,7 +69,23 @@ def stringBits(str): | |
| # end_other('abc', 'abXabc') → True | ||
|
|
||
|
|
||
| def end_other(a, b): | ||
|
|
||
| str1="abc" | ||
| str2="Xaabc" | ||
|
|
||
| def endwith(str1,str2): | ||
| str1=str1.lower() | ||
| str2=str2.lower() | ||
| l1=str1 | ||
| l2=str2 | ||
| if str1.endswith(l2) or str2.endswith(l1): | ||
| print("True") | ||
| else: | ||
| print("False") | ||
|
|
||
|
|
||
| endwith(str1,str2) | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This checks only if the the string 1 ends with string 2, What if the str 1 is abc and string 2 is abXabc? |
||
| # CODE GOES HERE | ||
|
|
||
| ##################### | ||
|
|
@@ -71,7 +99,13 @@ def end_other(a, b): | |
| # doubleChar('AAbb') → 'AAAAbbbb' | ||
| # doubleChar('Hi-There') → 'HHii--TThheerree' | ||
|
|
||
| def doubleChar(str): | ||
| def doubleChar(str1): | ||
| c = '' | ||
| for char in str1: | ||
| c = c + char*2 | ||
| return print(c) | ||
|
|
||
| doubleChar(str1) | ||
| # CODE GOES HERE | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dude stop using keyword 'str' its an inbuilt keyword, excluding this changes the function is correct |
||
|
|
||
|
|
||
|
|
@@ -114,4 +148,10 @@ def fix_teen(n): | |
| # count_evens([1, 3, 5]) → 0 | ||
|
|
||
| def count_evens(nums): | ||
| # CODE GOES HERE | ||
|
|
||
| count=0 | ||
| for i in nums: | ||
| if i%2==0: | ||
| count=count+1 | ||
| return count | ||
| count_evens(nums) | ||
Uh oh!
There was an error while loading. Please reload this page.