- 2

Find error in this it is showing syntax error

L = [ ‘a’, ‘b’, ‘c’, ‘d] V = ‘6’ for in L : L[i] += V V = V-2 Print(“V= “, V, “L = “, L )

28th Mar 2022, 5:08 AM
Priyansh Verma
7 Respuestas
+ 1
Based on snippet in original post, not the code bit L = [ 'a', 'b', 'c', 'd' ] # use of slanted quotes V = '6' # use of slanted quotes for i in range( len( L ) ): # use range( ) (rather than for...each) to support indices L[ i ] += V # <i> is list element, can't use <i> as index because they are strings V = str( int( V ) - 2 ) # must convert back to string after converting to int for decrementing print( f"{V=} {L=}" ) # use of slanted quotes
28th Mar 2022, 5:41 AM
Ipang
+ 6
Priyansh Verma for in L ? Did you check this syntax? Is this right ? "V = " V
28th Mar 2022, 5:35 AM
A͢J
A͢J - avatar
+ 4
Priyansh Verma Dude just go in lesson and check syntax again. You must know syntax properly.
28th Mar 2022, 5:37 AM
A͢J
A͢J - avatar
+ 2
Copy+paste that mess into a SoloLearn "code bit", then edit your original post to attach that code bit from your "my codes". Then we may help you.
28th Mar 2022, 5:23 AM
HungryTradie
HungryTradie - avatar
28th Mar 2022, 5:29 AM
Priyansh Verma
- 1
Dude I just want ryt ans
28th Mar 2022, 5:36 AM
Priyansh Verma
- 2
Code is in description
28th Mar 2022, 5:17 AM
Priyansh Verma