I'm making a program that prints all the prime numbers from a number that the user enters. Everything is working but I'm just having trouble printing the numbers.
def math(user):
  for num in range (user + 1):
    if num > 1:
      for i in range(2,num):
        if (num % i) == 0:
          break
      else:
        print('The Primes from 2 to ', user, 'are: ',num)
def main():
  user = ('Enter the maximum value to check primes up to: ')
  math(user)
When I enter 10 it prints:
Enter the maximum value to check primes up to: 10
The Primes from 2 to  10 are:  2
The Primes from 2 to  10 are:  3
The Primes from 2 to  10 are:  5
The Primes from 2 to  10 are:  7
I just want to have:
Enter the maximum value to check primes up to: 10
The Primes from 2 to  10 are:  2, 3, 5, 7
I think I have to add a list but I'm not sure where.