Testing the last 2
Lesson 17 of 19 in Coddy's Into the Past || Complete Beginner for Python Strings course.
Building of everything we have worked with up until this point. Combining multiple arguments, slicing and equivalence testing. Arguments themselves can then use in relation with another.
def test(s1,s2):
return s1 == s2This function performs an equivalence test if s1 is equal to s2
Challenge
EasyCreate a function which has 2 arguments. First find if string's last 2 character are equal to the substring (sub argument)
Example:
Input - "py" -- sub -first argument
"happy" -- string -second argument
Expected Output - True
Try it yourself
def test_last_2(sub,string):
#write your code here