#๐ Why is this prime sieve adding and witholding some numbers?
18 messages ยท Page 1 of 1 (latest)
@signal crystal
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I suggest you run it with a debugger and investigate it line by line to find the cause
It doesn't leave out 5.
This code is very hard to read, naming variables a single letter is a bad practice
lmao exactly
I think a single letter is fine for variables like x, y, and n or i. Adding more characters won't make them more expressive.
it affects the comprehnsibility and memory
if you name a variable by their function or use its more helpful to look into in later into the code
personally i wont remember what n does by last line
Eh, but for example the x variable is just that. It has no meaning beyond that. It's from a mathematical formula like 4xยฒ+yยฒ=n
i know sieve of erasthones brother
Atkin wasn't the brother of Eratosthenes. He was born about 2200 years later. ๐
It's only okay when you don't need to really know what part of a program do they serve, like in for loop, but not in this monstrosity
Python is not your ordinary math it's a programming language, so readability is important (but even in math people are trying to make formulas simple)
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.