- 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 )
7 RĂ©ponses
+ 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
+ 6
Priyansh Verma
for in L ?
Did you check this syntax?
Is this right ?
"V = " V
+ 4
Priyansh Verma
Dude just go in lesson and check syntax again.
You must know syntax properly.
+ 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.
- 1
Dude I just want ryt ans
- 2
Code is in description