String[1] Check
by CodeChum Admin
As long as you haven't forgotten about indexing, you'll be just fine.
Instructions:
Input three strings in different lines.
Print out "Same" if all of their 2nd characters are the same, else print out "Not the Same".
Input
Three lines containing a string on each.
Cry
Priest
Fry
Output
A line containing a string.
Same
str1=input('Enter the first string:')
str2=input('Enter the second string:')
str3=input('Enter the third string:')
if str1[1]==str2[1]==str3[1]:
print("Same")
else:
print("Not the Same")
Enter the first string:Cry
Enter the second string:Priest
Enter the third string:Fry
Same
Comments
Leave a comment