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


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


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


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


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? in c ,we uae for loop with n range & increment


for n in range(1, 100000):