I am python beginner.
I want to get the multiplication of two prime numbers of the N digits I have entered in python.
I even implemented two prime numbers and multiplying them.
For example, if I enter 2 in N, the multiplication of the 2-digit prime number should be output.
I don't know what to do next.
My code is
import random
nums = []
for num in range(10,100):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
nums.append(num)
prime = random.sample(nums, 2)
print(prime)
N = prime[0] * prime[1]
print('multiply with the two prime numbers:', N)
And 'range' is a randomly set range in "for num in range(10,100)"
Aucun commentaire:
Enregistrer un commentaire