![]() ![]() ![]() it’s better to save a list of previously encountered primes, but with one line of code, i couldn’t figure out a way to initialize and populate a list of primes to check against. ![]() Write a program in Python to check given number is prime or not. this (inefficiently) checks against all odd numbers up to the square root. Covered Topics are number, string, linked list etc. This is roughly equivalent to the below code. (oh, and these solutions work for negatives, zero, and one, as well-returning an empty list) def one_line_primes(n): ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |