+ 3

[CHALLENGE] See if the End Of The String Matches The Start Of The Second String

Write a function that takes two strings and checks if the last 4 letters of the first string matches the first 4 letters of the second string. Examples: CheckString("Hello", "ello") Challenge inspired by: https://edabit.com/challenge/H9ohpGMyqJ9bAkqE5

6th Mar 2018, 1:31 PM
RuthlessDust
RuthlessDust - avatar
7 Antworten
+ 5
chkstring=lambda a,b:a[-4:]==b[:4]
6th Mar 2018, 9:34 PM
VcC
VcC - avatar
6th Mar 2018, 2:38 PM
Tiger Jones
Tiger Jones - avatar
+ 2
Hey, RuthlessDust! Thank you for the challenge! Here is my small piece of a code (please see comment for correct input format before RUNNING the code): (Python 3) https://code.sololearn.com/cxec27Wlhe8a/#py Lambda alternative included in the comments
12th Mar 2018, 9:59 PM
Andrey Vostokov
Andrey Vostokov - avatar
6th Mar 2018, 2:39 PM
Boris Batinkov
Boris Batinkov - avatar
0
https://code.sololearn.com/cPh6jJZQP41s/?ref=app
7th Mar 2018, 3:59 PM
hinanawi
hinanawi - avatar
0
@hinanawi your code doesn't work. If you input hello and gdro, it outputs matches
7th Mar 2018, 4:12 PM
Tiger Jones
Tiger Jones - avatar
0
@Tiger Jones my bad, forgot to put the break in. should work now
7th Mar 2018, 4:49 PM
hinanawi
hinanawi - avatar