0
Can you write a code for me (using Python 3), please?
I wanna write a code that collect the prime numbers that are before the number which I(or the user of my program) input. For example : The input :11 The output :17(2+3+5+7) And so on... Can I do it with out a (for loop)?
3 Antworten
0
A=int(input('enter number\n'))
Print(A*A*A)
0
After defining your is_prime() function, you can avoid for loops like so:
sum(filter(is_prime, range(limit)))