Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post over 3 years ago by General Sebast1an‭.

0 / 255
Where did my proper divisor sum program went wrong?
  • Here in Python, I created a program for [this challenge](https://codegolf.codidact.com/posts/282244) and I'm having trouble debugging it. I already fixed most errors I have on my program but here's what I have left:
  • ```
  • x=y=z=[];i=0.0;a=int(input());b=0
  • for c in range(1,a+1):
  • for d in range(1,a):
  • i+=1
  • if a/c==i and c!=a:b+=c
  • if b<a:x.append(c)
  • elif b>a:y.append(c)
  • else:z.append(c)
  • i=b=0
  • print("[",end='')
  • for j in x:
  • print(j,end='')
  • if j!=len(x):print(" ",end='')
  • print("], [",end='')
  • for j in y:
  • print(j,end='')
  • if j!=len(y):print(" ",end='')
  • print("], [",end='')
  • for j in z:
  • print(j,end='')
  • if j!=len(z):print(" ",end='')
  • print("]",end='')
  • ```
  • Basically, I'm trying to make a number checker so I can get the inputted number's proper divisor sum, which in my understanding is the sum of divisors that results in a quotient that can be formatted as `n.00000...`, but the resulting output leaves me with all the numbers from 1 to the input. [See it for yourself! (SIFY)](https://tio.run/##lY5fC4IwFEef9VOsXtpQSoleZrcvIj5c56qJrGEGzi9v3Yr@QAg9Dc6Pe3ac744nux7HHjwMkBeZgWSZZAjGdtxYd@m4EFkJSbg/tUwxY1mL9qB5GmOUChkGxKsvTjQwEaT07BmuFIBhaCumZoCyjECFNJRblP0SndO24kqEgW6I7lD6b3rWcvgkBijItdQ4z@fxjcNiIe6JNaX0t4LHXL9G@rGeQaMt74V8HrP38ZMUMftl9NNG/79xmDYOU8YXGcd0cwU)
  • I've been trying to figure out where the problem lies and I suspect it has to do with the first `for` loop, but I don't know where exactly to fix. Where did I mess up or how do I fix this?
  • Here in Python, I created a program for [this challenge](https://codegolf.codidact.com/posts/282244) and I'm having trouble debugging it. I already fixed most errors I have on my program but here's what I have left:
  • ```python
  • x=y=z=[];i=0.0;a=int(input());b=0
  • for c in range(1,a+1):
  • for d in range(1,a):
  • i+=1
  • if a/c==i and c!=a:b+=c
  • if b<a:x.append(c)
  • elif b>a:y.append(c)
  • else:z.append(c)
  • i=b=0
  • print("[",end='')
  • for j in x:
  • print(j,end='')
  • if j!=len(x):print(" ",end='')
  • print("], [",end='')
  • for j in y:
  • print(j,end='')
  • if j!=len(y):print(" ",end='')
  • print("], [",end='')
  • for j in z:
  • print(j,end='')
  • if j!=len(z):print(" ",end='')
  • print("]",end='')
  • ```
  • Basically, I'm trying to make a number checker so I can get the inputted number's proper divisor sum, which in my understanding is the sum of divisors that results in a quotient that can be formatted as `n.00000...`, but the resulting output leaves me with all the numbers from 1 to the input. [See it for yourself! (SIFY)](https://tio.run/##lY5fC4IwFEef9VOsXtpQSoleZrcvIj5c56qJrGEGzi9v3Yr@QAg9Dc6Pe3ac744nux7HHjwMkBeZgWSZZAjGdtxYd@m4EFkJSbg/tUwxY1mL9qB5GmOUChkGxKsvTjQwEaT07BmuFIBhaCumZoCyjECFNJRblP0SndO24kqEgW6I7lD6b3rWcvgkBijItdQ4z@fxjcNiIe6JNaX0t4LHXL9G@rGeQaMt74V8HrP38ZMUMftl9NNG/79xmDYOU8YXGcd0cwU)
  • I've been trying to figure out where the problem lies and I suspect it has to do with the first `for` loop, but I don't know where exactly to fix. Where did I mess up or how do I fix this?

Suggested over 3 years ago by deleted user