In the following code I'm trying to do basic calculations with coulumb's law
#Coulombs Law ''' F = (9*(10**9)) * (Q1*Q2) / (d**2) ''' base = 10 Q1mult = raw_input('First enter multiplier of base 10 charge/coloumb(Q1):') Q1exp = raw_input('Now enter exponent of base 10(Q1):') Q1 = int(Q1mult)*(10**int(Q1exp)) Q2mult = raw_input('First enter multiplier of base 10 charge/coloumb(Q2):') Q2exp = raw_input('Now enter exponent of base 10(Q2):') Q2 = int(Q2mult)*(10**int(Q2exp)) d = raw_input('Enter distance of charges/coulumbs from Q1 to Q2:') a = (9*(10**9))*((int(Q1))*(int(Q2)))/((int(d))**2) print a ********************************************************** Q1 and Q2 are to be entered as base ten scientific notation. When I try to input Q1 as raw input, entering in ((2*(10**7)), I get: ValueError: invalid literal for int() with base 10: '((2)*(10**7))' Which is why I broke it down into it's sub-components(i.e. what to multiply the base 10 by[Q1mult] and what exponent to use with the base 10[Q1exp]). Is there a better way to write this, and what would be the best way to insert the scientific notation if not this way. I know there is probably a module, but this is for my own practice. TIA David _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor