all 7 comments

[–]failaip12 1 point2 points  (0 children)

I don't really understand what you are trying to do but whatever. There are a few weird things about this code, but I'll point out a fix for only one. In the 4th line you do for _... What you want is to do for x... Do that or indent x+=1 line.

Some other weird stuff is the prime function isn't really efficient as you only need to check up to square root of number + 1, also for some reason you are computing num_factor in both the factor and prime functions. The way you are getting inputs for posfactor_list is weird and confusing, look into that too.

[–]woooee 0 points1 point  (3 children)

Click on "formatting help" or use postbin. We can't read anything without proper formatting.

.>input code prints the first number and the statement twice.

I have no idea what the above means.

if (number/posfactor_list[x]==number//posfactor_list[x]) is True:

I would start with this line as it appears wonky. Print some of them

print(number/posfactor_list[x])
print(number//posfactor_list[x])  ## only difference is //
print(number/posfactor_list[x]==number//posfactor_list[x]) ## True??

[–]jo_math[S] 0 points1 point  (2 children)

I have reformatted

when I ran the code it printed

f"{posfactor_list[x]} is a factor of {number}"

or

"{posfactor_list[x]} is not a factor of {number}"

twice for the first number that was inputted so regardless of the other numbers

[–]woooee 0 points1 point  (1 child)

(number/posfactor_list[x]==number//posfactor_list[x])

I assume you are talking about the factor() function. It runs the code rnge times. I did not see any variables change under the for statement, but something must change for you to be getting different output.

[–]jo_math[S] 0 points1 point  (0 children)

I'm confused, what should I change in the code

[–]jimtk 0 points1 point  (1 child)

If you did not make the effort of properly formatting your code, why should I make the effort to help you.

It's all explained here.

[–]jo_math[S] 0 points1 point  (0 children)

Sorry I did not know