What wrong with this code. Please help? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

What wrong with this code. Please help?

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

12th Nov 2020, 4:37 PM
Ria Zakia
Ria Zakia - avatar
6 Respuestas
+ 6
Check the last line indentation ,It should have same indentation like the previous line, n[i]=="solo" print (i)
12th Nov 2020, 4:46 PM
Abhay
Abhay - avatar
+ 4
Thanks u BroFar,MICAEL and Abhay for ur help.
12th Nov 2020, 5:30 PM
Ria Zakia
Ria Zakia - avatar
+ 3
Nsubuga Sulaiman here is basically what you have to do as you have to create a int to str environment in order to get to print "solo" based on a number being dividable by 3 with a zero remainder https://code.sololearn.com/cGa158i7er4V/?ref=app
12th Nov 2020, 5:15 PM
BroFar
BroFar - avatar
+ 3
n=int(input()) for i in range(1,n,2): if i%3==0: print(i,': solo')
12th Nov 2020, 5:26 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
what is wrong? first you make a INT an a input for it, next you take him like a ARRAY, and so on. Finally you compare an element of the "array"(is a number on this case) like a string, you don't do any cast for reorder, your input is wrong since int(input()). You must learn how to get input for an array and his declaration, but this case is input of an array for strings, buts sems that are 2 dimensional, like one piece string an another int, a pair. if you dont wanna have many problems i suggest use two diferent array with the same size of elements. Good luck. sory for bad english.
12th Nov 2020, 4:52 PM
MICAEL MIRANDA
MICAEL MIRANDA - avatar
+ 1
Make sure you indent the code properly, with a fixed indention space like this: n=int(input()) for i in range(1,n,2): if n[i]%3==0: n[i]="solo" print(i) And the == operator checks whether the two values and types match. If you want to set n[i] to "solo", use the = operator.
13th Nov 2020, 3:23 AM
Boay.JS
Boay.JS - avatar