Kandi
  • Kandi
I am trying to run the following python script: x = 100 divisors = () for i in range(1,x): if x%i == 0: divisors = divisors+(i,) When run, I do not get an answer. Suggestions?
Computer Science
katieb
  • katieb
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
may not make a different but I would put if x % i == 0: (put in a space before and after %
anonymous
  • anonymous
What output are you looking for? Is that all the code? I'm thinking that you should append to your list instead of just adding it. Tr this divisors.append(i)
anonymous
  • anonymous
Also, if that is your complete code, you have forgotten to write your print statement. I.e. print divisors I ran your code and it works fine for me.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
One more thing, forget the "divisors.append(i)" code i gave you earlier, that code only works for lists and I see you initialised "divisors" as a tuple. Though you can use the code I mentioned if you change your 2nd line to divisors = [] Hope that sorts you out.
Kandi
  • Kandi
Thank you!!! I didn't have the print statement...so simple.
anonymous
  • anonymous
No problem :D

Looking for something else?

Not the answer you are looking for? Search for more explanations.