[Tutor] Please Help

2013-03-21 Thread Arijit Ukil
en(list_of_lists1)): tt = list_of_lists1[index] print 'Current value :', tt avg =average (tt) This gives an error: def average(s): return sum(s) * 1.0 / len(s) TypeError: unsupported operand type(s) for +: 'int' and 'str' I also attach the file i am re

[Tutor] Please Help

2013-03-22 Thread Arijit Ukil
for i in range(len(number_list)): if number_list[i] > 5: s_data = number_list[i] print 'Data val:', s_data The problem is: it is printing only the last value, not all the values. In this case '10', not '9,8,6,10'. Regards, Arijit Ukil Tata

[Tutor] Please Help

2013-03-22 Thread Arijit Ukil
range(math.floor(float(len(number_list)/2))): if (k< math.floor(float(len(number_list)/2))): number_list_1[k] = number_list[k*2 + 1] print 'data: ', number_list_1 Please help Regards, Arijit Ukil Tata Consultancy Services Mailto: arijit.u...@tcs.com Website: http:

[Tutor] Help required

2013-04-04 Thread Arijit Ukil
tafile = f.readlines() list_of_lists = datafile for data in list_of_lists: lstval = data.split (',') timest = float(lstval[0]) energy = float(lstval[1]) f.close() print timest Regards, Arijit Ukil Tata Consultancy Services Mailto: arijit.u...@tcs.c

[Tutor] running python from windows command prompt

2013-04-10 Thread Arijit Ukil
val = avrg(data) out = pow(val,2) return out Pls help. Regards, Arijit Ukil Tata Consultancy Services Mailto: arijit.u...@tcs.com Website: http://www.tcs.com Experience certainty. IT Services Business

[Tutor] Running python from windows command prompt

2013-04-10 Thread Arijit Ukil
: val = avrg(data) out = pow(val,2) return out I am using python 2.6. My intention is to run from windows command prompt as python my_python.py 1 3 2 However I am getting error: No such file in the directory, Errno 21 Pls help. Regards, Arijit Ukil Tata Consultancy Servi

Re: [Tutor] Running python from windows command prompt

2013-04-10 Thread Arijit Ukil
:]) When running in command line I am getting these errors: In case 1. data = sys.argv[1] In case 2, data = float(sys.argv[1]) In case 3, data = int (sys.argv[1]) Regards, Arijit Ukil Tata Consultancy Services Mailto: arijit.u...@tcs.com Website

[Tutor] sha-256 without using hashlib

2013-04-26 Thread Arijit Ukil
I like to implement sha-256 without using implement. It is easy using hashlib as: import hashlib m = hashlib.sha256() m.update("hi") print m.hexdigest() If anybody has pointer on sha-256 implemented without using hashlib library, please share. Regards, Arijit Ukil Tata Consultanc

[Tutor] Regarding python function arguments

2013-06-11 Thread Arijit Ukil
i am writing following python function: def my_func (arg1, arg2, arg3): however, I am not always going to pass all the arguments. sometimes only arg1 is passed, sometimes arg1 and arg2 are passed; sometimes arg1, arg2, arg3 are passed. How can i manage this? Regards, Arijit Ukil Tata

[Tutor] Data persistence problem

2013-06-20 Thread Arijit Ukil
() returns 45 at the first call, x should retain 45 even in multiple calls. Pls help. Regards, Arijit Ukil Tata Consultancy Services Mailto: arijit.u...@tcs.com Website: http://www.tcs.com Experience certainty. IT Services Business