(POSSIBLE SCHOOL ASSIGMENT) I am having a logic error

n = int(input())
ln = list()
for i in range(2, n+1):
	isPrime = True
  for j in range(2, (i**0.5+1)):
    if (i%j == 0):
      isPrime = false
	if isPrime:
    ln.append(i)
	ln.reverse()
  print(*ln)

I dont know the answer, so yeah

HE.

n = int(input())
ln = list()
for i in range(2, n+1):
	isPrime = True
  for j in range(2, (i**0.5+1)):
    if (i%j == 0):
      isPrime = false
	if isPrime:
    ln.append(i)
	ln.reverse()
  print(*ln)

an somebody help me???

Patients is key… Also you pit this topic in the wrong category

What exactly are you trying to do? This post doesn’t give any description of the problem.

What are you showcasing? Please make a topic in #code-help:python for python help.

isPrime = False

False is a keyword, type False instead of ‘false’ in the code after checking divisibility of i with j

1 Like

please put your code into a code block by putting ```py
before your code and ``` after.
It makes the code format properly and have syntax highlighting, like this:

def say_hello_world(times):
    for x in range(1, times):
        print("Hello, world")

say_hello_world(1)

(Yes I actually enjoyed writing that code)

1 Like

Are you trying to say that your code is not running as intended?

1 Like

isPrime = False

Type F in caps for false

1 Like

What is the purpose of your text? Plus please format the code.

@Winstenna Can you send a like to your code? Or if @QwertyQwerty88 is able to find it like she always does :laughing:.

Lol, looks like they already fixed it based on a different post they made. That post has been unlisted now.

But after a quick look at their Repls I couldn’t find this one.

Lol nice good find :laughing:

If this is a school assignment there’s not much we can do.