+ 1
Flowing Word Code Coach Python
Hello! My code to solve the abovementioned puzzle works in Code Playground but doesn’t work in the actual solution coding page. Can anyone help me to see what is wrong? Much appreciated!! Code: stringinput = str(input()) def matches(text): separate = text.split() i = 0 count = 0 while i < len(separate)-1: if separate[i][-1] == separate[i+1][0]: count += 1 else: break i +=1 if count == len(separate)-1: print("true") else: print("false") matches(stringinput)
8 ответов
+ 4
T Y ,
when i run your code in the code coach exercise an error occures:
"inconsistent use of tabs and spaces in indentation"
after fixing this, the code runs properly. for future codes you should use 4 spaces per indentation level.
+ 1
Casing does not matter.
Pon Nok
should be outputs true.
Your code outputs false and this is wrong.
+ 1
i = input().split()
temp = i[0][-1::]
c = 1
for x in range(1,len(i)):
if i[x][0:1:] == temp:
temp = i[x][-1::]
c += 1
else:
print("false")
break
if c == len(i):
print("true")
+ 1
phr = input().split()
u=0
n=1
for i in range(1,len(phr)):
if phr[u][-1] == phr[n][0]:
flow = 'true'
u+=1
n+=1
else:
flow = 'false'
print(flow)
0
What's the code problem?
0
Can someone please explain how one of these working codes works? I’m having a real struggle with this one.
- 3
i = input().split()
temp = i[0][-1::]
c = 1
for x in range(1,len(i)):
if i[x][0:1:] == temp:
temp = i[x][-1::]
c += 1
else:
print("false")
break
if c == len(i):
print("true")
- 3
i = input().split()
temp = i[0][-1::]
c = 1
for x in range(1,len(i)):
if i[x][0:1:] == temp:
temp = i[x][-1::]
c += 1
else:
print("false")
break
if c == len(i):
print("true")