I'm working on a program that generates random equations and always get errors such as "cannot divide by zero" and "overflowerror: result too large" that prevent the generating from continuing. Is there a way to prevent the program from freezing and getting error messages?
import random
import math
while 1:
    try:
        var = ['math.pi','999999999999999999999','(5/3)']
        s1 = '**'
        s2 = '**'
        s3 = '**'
        s4 = '**'
        v1 = var[random.randrange(0,2)]
        v2 = var[random.randrange(0,2)]
        v3 = var[random.randrange(0,2)]
        v4 = var[random.randrange(0,2)]
        v5 = var[random.randrange(0,2)]
        result = eval(v1+s1+v2+s2+v3+s3+v4+s4+v5)
        print v1+s+v2+s+v3+s+v4+s+v5
    except:
        print("error found moving on")
 
    