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.

10th Sep 2018, 8:53 AM
Srivathsa Sharma
Srivathsa Sharma - avatar
4 Respuestas
+ 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
10th Sep 2018, 11:19 AM
Ferhat Sevim
Ferhat Sevim - avatar
+ 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
10th Sep 2018, 9:23 AM
Markus Kaleton
Markus Kaleton - avatar
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
10th Sep 2018, 9:34 AM
Srivathsa Sharma
Srivathsa Sharma - avatar
0
for n in range(1, 100000):
10th Sep 2018, 10:13 AM
Paul
Paul - avatar