kvmmi.blogg.se

Prime number list to 100 python
Prime number list to 100 python









#ensures that the main program only runs when the functions have not been imported into another file.

prime number list to 100 python prime number list to 100 python

Why? # returns all integers from 2 to a limit given by the user. As the line with range is not a list I fixed it only to improve the code, but when I changed the name of the value from 'lista' to another name, I saw that it doesn't work too. It runs as I expected, but when I tried deleting the first list assignment line and include the range function directly into the comprehension, it doesn't work. #Ensures that the main program only runs when the functions have not been imported into another file. #call the function which selects the numbers and returns the result. #filters the prime numbers and places in a list.

prime number list to 100 python

I wrote this code: # returns all integers from 2 to a limit given by the user. I was trying to reduce the maximum amount of lines I could and was surprised with some situations I can't understand. I was trying to write a code to select the prime numbers in a list.











Prime number list to 100 python