+ 2

What is invalid syntax in this code

https://code.sololearn.com/chW0wzY7A2pG/?ref=app

1st Oct 2022, 11:51 AM
Rahul Kanade
5 Réponses
+ 7
Rahul Kanade , your code has a poor formatting, specially for the indentation (using only 1 space per indentation level has a bad readability). > use 4 spaces for each indentation level as it is recommended in the python python style guide
1st Oct 2022, 6:31 PM
Lothar
Lothar - avatar
+ 6
#read comments... What is your task by this? w = input() v = len(w) print(v) i = 0 for g in w: i<v # no effect statement if g[i] in g[i+1:] and i+1 < v: print("false") break elif : #condition is missing , also wrong indentation i+1=v # wrong way : do v = i+1 left side should be variable print("true") break else: print("true") break
1st Oct 2022, 12:09 PM
Jayakrishna 🇮🇳
+ 4
You are using one equal (=) sign in elif, you need to use 'double equals' (==) for comparision change, (line 12) -> i+1=v to -> i+1 == v Also, Fix the formatting, do it as suggested by Lothar and Jayakrishna (to fix problem: delete one space in line 12)
1st Oct 2022, 6:47 PM
Sandeep
Sandeep - avatar
+ 4
elif: is invlid syntax. Condition missing. Rahul Kanade You may trying, elif i+1 == v : #correct way
1st Oct 2022, 8:12 PM
Jayakrishna 🇮🇳
+ 1
I just want to know why it is showing invalid syntax in elif statement
1st Oct 2022, 6:23 PM
Rahul Kanade