Your thoughts please. | SoloLearn: Learn to code for FREE!

0

Your thoughts please.

i need to solve a simple math arithmetic problem & want to save result in excel..ex.3^n+5.. n=1,2,....9.any suggestions plz.

9/10/2018 8:53:49 AM

Srivathsa Sharma

4 Answers

New Answer

+3

import csv def func(n): yield 3**n+5 out_csv = open('TestFile.csv', 'w') wr = csv.writer(out_csv,delimiter=',') for n in range(9999): wr.writerow(list(func(n))) out_csv.close() #Try this way if it can help you

+1

you could save it as csv. or use xlsxwriter module to save data straight to an excel document. for n in range(x): # x is the n sequence start and end separated by , fun = 3**n+5 # write fun to file here

0

Thanks Markus...I can save in csv now. as im computing for higher values of n 5 to 6 digits..i want results at one go..for value of n =1 to 99999..any syntax to be used? ..like in c ,we uae for loop with n range & increment

0

for n in range(1, 100000):