i've kind of found answer, to convert them to sets (which actually works well because i need to remove duplicates) but if i do that, the numbers go out of order, is it possible to put them back in order from smallest to largest?
yeah, that's basically how i did using sets... really i apologize all the information i needed was in the turorial, it just took me some time to get it right...
a = set(a)
b = set(b)
c = b&a
yeah, i know for the [0,1,2,3,4] situation making a list is the long way to take, in reality after the "n in range" there was some other stuff before appending to x....
basically i was making a very inefficient prime number finder:
print ("Prime Number Finder")
x = input("What's the upper range?: ")
if x >= 2:
print ("2")
a = []
b = []
for n in range(x+1):
for m in range(n):
if n is not 0:
if m is not 0:
if m is not 1:
if n % m is 0:
a.append(n)
else:
b.append(n)
a = set(a)
b = set(b)
c = b-a
for h in sorted(set(c)):
print h
i know there's probably much better ways to do it, but it works well and the method behind how it works is fairly interesting...
actually i suppose instead of making a new list "b" i could have just used the list "range n"...as you showed:
b = range(x)
that would actually be better because 2 would not fall out as an exception, and i wouldn't have to say print(2) as i did above
Dear Friends, I am facing a problem, I have two forms,
Form1 Has one DataGrideview and Button redirect to Form2, which has Button(Browse Excel File) and combobox(Sheet No of excel ...