+ 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)

19th Jun 2022, 8:25 AM
T Y
8 Antworten
+ 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.
19th Jun 2022, 4:27 PM
Lothar
Lothar - avatar
+ 1
Casing does not matter. Pon Nok should be outputs true. Your code outputs false and this is wrong.
19th Jun 2022, 9:11 AM
JaScript
JaScript - avatar
+ 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")
28th Jun 2022, 7:05 PM
Martin Valdés Mallaug
+ 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)
2nd Jan 2023, 2:25 AM
Egor Erofeev
Egor Erofeev - avatar
0
What's the code problem?
19th Jun 2022, 9:02 AM
JOKER
JOKER - avatar
0
Can someone please explain how one of these working codes works? I’m having a real struggle with this one.
31st Jan 2023, 9:54 AM
Gabriel Akio Ponte Arake
Gabriel Akio Ponte Arake - avatar
- 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")
13th Nov 2022, 8:36 PM
Anita chaubey
Anita chaubey - avatar
- 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")
13th Nov 2022, 8:36 PM
Anita chaubey
Anita chaubey - avatar