Note that there are some explanatory texts on larger screens.

plurals
  1. POends_with function: One string at the end of the other and Vise Versa in Python. Issue with solution assist?
    primarykey
    data
    text
    <p>Not the greatest title ever... Anyways Hello! I am currently answering this question but I am not meeting all the exceptions D: Any help would be amazing! (Sorry again for the crappy title).</p> <p>Question:</p> <hr> <p>Ends With Given two strings, return True if either of the strings appears at the very end of the other string, ignoring upper/lower case differences (in other words, the computation should not be "case sensitive").</p> <p>Examples / Tests:</p> <hr> <pre><code>&gt;&gt;&gt; end_other('Hiabc', 'abc') True &gt;&gt;&gt; end_other('AbC', 'HiaBc') True &gt;&gt;&gt; end_other('abc', 'abXabc') True </code></pre> <p>Test Results:</p> <hr> <pre><code>Call Expected Received Correct end_other('Hiabc', 'abc') True True true end_other('AbC', 'HiaBc') True True true end_other('abc', 'abXabc') True False false #Cond. Not being met end_other('Hiabcx', 'bc') False False true end_other('abc', 'abc') True True true end_other('xyz', '12xyz') True True true end_other('yz', '12xz') False False true end_other('ab', 'ab12') False False true </code></pre> <p>(Sorry for failed Formatting)</p> <p>My Code:</p> <hr> <pre><code>def end_other(s1,s2): s1 = s1.upper() s2 = s2.upper() if s1[2:6] == s2: return True elif s2[2:6] == s1: return True elif s2 == s1: return True else: return False </code></pre> <p>What I expect is wrong:</p> <hr> <p>The website I am using is not really known for it's solid answers... but I know it's quite possible there is a flaw in my code. So If you have any suggestions please let me know!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload