+ 5

Is the following code correct?

x=[] for y in range(12): if y[b] % [/b]2 == 0: x.append(y) continue print(x) https://sololearn.com/compiler-playground/csV77YpQt9uW/?ref=app

12th Jan 2024, 7:36 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
16 ответов
+ 5
do not put links in the tag section. we cannot click on your code. tag the relevant programming language there is no [b] [/b] tag in Python.
12th Jan 2024, 7:50 PM
Lisa
Lisa - avatar
+ 5
Lisa BroFar Milad Hamidi Thanks for your help
12th Jan 2024, 9:29 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
+ 4
You sure you write down the code the right way? Because this is definitely gonna encounter with syntax error and name error.
12th Jan 2024, 7:46 PM
Milad Hamidi
Milad Hamidi - avatar
+ 4
i think reporting the question/ code as wrong – which you already did – is the only thing we can do... i don't think sololearn currently tries to fix anything about the challenges at the moment, so no idea if/when it might get fixed
12th Jan 2024, 9:21 PM
Lisa
Lisa - avatar
+ 4
you can leave your thread here as long as you like and delete it whenever you like. it's totally up to you!
12th Jan 2024, 9:27 PM
Lisa
Lisa - avatar
+ 3
I found this question somewhere on Sololearn. I have reported it many times, but it is still not corrected.
12th Jan 2024, 7:49 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
+ 3
As Lisa pointed out Abdurahman Jemal Adem the code should be x=[] for y in range(12): if y%2 == 0: x.append(y) continue print(x) I'm confused as to where you obtained [b] [/b] BB coding format
12th Jan 2024, 8:46 PM
BroFar
BroFar - avatar
+ 2
BroFar if that's the formatting of the challenge, it might be the same as in the old course/ when users could submit own lessons?
12th Jan 2024, 9:09 PM
Lisa
Lisa - avatar
+ 2
Lisa and BroFar I have been facing this question many times, but it should not be part of the challenges for new challengers. That's why I asked it here.
12th Jan 2024, 9:18 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
+ 1
from the error message you can see that the code is not correct. there is no [b] [/b] tag in python. wherever the code is taken from, it had some text formatting and the formatting tags were also copied. just remove them.
12th Jan 2024, 8:24 PM
Lisa
Lisa - avatar
+ 1
BroFar you're right, and I understand that. I found this code as a correct answer to a code challenge question. But the code itself is not correct.
12th Jan 2024, 8:59 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
+ 1
remove it from where? i thought it was part of a challenge quiz?
12th Jan 2024, 9:24 PM
Lisa
Lisa - avatar
+ 1
Abdurahman Jemal Adem , I remember playground examples in various lessons in various courses where the given code is intentionally incorrect, and your job is to correct it. Might this be one of those examples? I would correct it thus. x = [] for y in range(12): if y%2 == 0: x.append(y) continue print(x) # [0, 2, 4, 6, 8, 10]
13th Jan 2024, 12:06 AM
Rain
Rain - avatar
0
Lisa sorry for that, but now I have changed it.
12th Jan 2024, 8:13 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
0
So now what do you recommend me Lisa Should I remove it?
12th Jan 2024, 9:23 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar
0
Lisa From my question
12th Jan 2024, 9:25 PM
Abdurahman Jemal Adem
Abdurahman Jemal Adem - avatar