My cpu is at max on a simple program and it doesn't run

This python program makes my cpu reach its max limit:

x = int(input())
c = 0
while x != 0:
	b= x//10
	if b % 2 == 0 :
		c+=1
print(c)

Is this normal ? When it reaches max cpu the Repl doesn’t work anymore and my code doesn’t run. :pleading_face: plz help

I have the same problem. I even just open a file and it happens.

Have you found a solution?

Thank you for answering either way, its nice to see that I’m not the only one :+1:

1 Like

Yeah that’s just replit… they decreased the CPU to the point where you can’t even run simple programs because they haven’t revamped their architecture to use less CPU…

Occasionally do kill 1 in a shell. This seems ti calm the cpu somewhat …

1 Like

Also thought that maybe the while loop was infinite so i tried this :+1:

x = int(input())
c = 0
while x != 0:
	x= x%10
	if x % 2 == 0 :
		c+=1
print(c)

Same thing it doesn’t print what its supposed to.

How do you kill it ?

1 Like

Could you format your code using ```py as it could be a problem with your indentation.

For example:

print("Hello, world!")
Raw ```py
print("Hello, world!")
```

In which part of the code ?

1 Like

Open the shell tab (go to tools → Shell) and type kill 1

Your entire code, or you can send a link to your Repl (not invite).

Where is the link ? Cant find it

1 Like

Just copy the url in the editor, at the top of your screen

https://replit.com/@GabrielDLH/cpu#main.py
this ?

1 Like

Yep, that’s it.

When 0 is inputted it works:

But when a different number is inputted, it seems to infinitely take input.

Is this the desired behavior? (I’d assume not)

1 Like

No its supposed to tell me the number of numbers divisble by 2

2 Likes

What do you mean by this?

Btw your code is an infinite loop, so that might be your problem not the usual cpu getting busy catching butterflies problem.
You need to put the input comment in the while loop (I would assume)

2 Likes

Like how many digits of the number are divisible by 2

1 Like