mardi 28 avril 2020

I want to convert num to list type

I am learning Python. And I am a beginner to Python.

I want to receive two randomly extracted prime numbers as a list in python. And how can I make the number of digits multiplied by the randomly extracted prime number less than 11 digits? My code is

import random

lower = int(input("Enter lower range: "))  
upper = int(input("Enter upper range: "))  

for num in range(lower,upper + 1):  
   if num > 1:  
       for i in range(2, num):  
           if (num % i) == 0:  
               break  
       else:
         print(num)

I made only the prime number.

For example, if you enter 10, the product of two primes must be 10 digits. Two prime numbers are random.

If you enter 2, two prime numbers are randomly extracted. Assuming 11 and 3 here, the product of the two numbers is 33, so you get two digits. It is like this.




Aucun commentaire:

Enregistrer un commentaire