Hi again i have programmed a thing that asks for 2 numbers and does a series of things to it.But i want to round the square-rooted numbers to about 6 digits e.g. 5.12345. How can this be done?
from math import sqrt
running = 'Y'
while 'Y' in running or 'y' in running:
#defining numbers
startn = float(raw_input('What is the starting number'))
startn2 = startn
endn = float(raw_input('What is the ending number?'))
endn2 = endn
#defining lists
num = []
nums = []
numsq = []
while startn2 != (endn2+1):
#just the numbers
a = int(startn2)
num.append(a)
startn2+=1
startn2 = startn
print 'numbers without changing are:', num
while startn2 != (endn2+1):
#numbers squared
a = int(startn2*startn2)
nums.append(a)
startn2+=1
startn2 = startn
print 'numbers squared are:', nums
while startn2 != (endn2+1):
#numbers square-rooted
#Here is my problem, i want to simplify it to about 6 digits e.g. 5.12345
a = sqrt(startn2)
numsq.append(a)
startn2+=1
startn2 = startn
print 'numbers square-rooted are:', numsq
running = raw_input('Try another set? (Y or N)')
I was trying to make a program that gives very accurate answers to problems. The accuracy I want is of like 20000 terms.
For eg. 10/3 is written as 3.33333333333333333...20,000 times.
So, is it possible in Python?
Also, please answer in reference to Python 3.0, if possible...
I was trying to make a program that gives very accurate answers to problems. The accuracy I want is of like 20000 terms.
For eg. 10/3 is written as 3.33333333333333333...20,000 times.
So, is it possible in Python?
The code I tried to get square root of 2 is:
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.