[Tutor] Generate Prime Numbers

2015-05-29 Thread Mirage Web Studio
Hello, Below is a sample code i created. Can i better it any way? Thanks George --- import time start_time = time.time() def IsDivisibleBy3(number):#string variable v=0 for c in number: v=v+int(c) if v%3==0:

Re: [Tutor] Generate Prime Numbers

2015-05-30 Thread Mirage Web Studio
On 2015-05-29 11:18 PM, Alan Gauld wrote: On 29/05/15 16:28, George wrote: Below is a sample code i created. Can i better it any way? Of course. There is always improvements that can be made. But in your case there are quite a few! def IsDivisibleBy3(number):#string variable v=0

Re: [Tutor] Generate Prime Numbers

2015-06-10 Thread Mirage Web Studio
On 2015-05-31 5:04 AM, Alan Gauld wrote: On 30/05/15 19:14, George wrote: Excuse me please for replying late. I got lists to use the method and it is more efficient and faster. (Takes about 10 secs to process first 50 mil numbers) But now another problem i seem to notice that only 1 core

Re: [Tutor] Generate Prime Numbers

2015-06-11 Thread Mirage Web Studio
On 2015-06-11 12:38 AM, Laura Creighton wrote: In a message of Wed, 10 Jun 2015 23:11:36 +0530, George writes: On 2015-05-31 5:04 AM, Alan Gauld wrote: On 30/05/15 19:14, George wrote: Excuse me please for replying late. I got lists to use the method and it is more efficient and faster. (

[Tutor] Fwd: Problem reading large files in binary mode

2014-06-12 Thread Mirage Web Studio
Hello I am new to python programming. while trying it out i find that in my code file io.read is not reading large files particularly over 1 gb. my code is posted below. i am working on python 3.3 on windows with ntfs partition and intel corei3 ram 3gb. the execution always stops saying error

[Tutor] Problem reading large files in binary mode

2014-06-13 Thread Mirage Web Studio
Try reading the file in chunks instead: CHUNKSIZE = 2**20 hash = hashlib.md5() while True: chunk = f.read(CHUNKSIZE) if not chunk: break hash.update(chunk) hashvalue = hash.hexdigest() Thank you peter for the above valubale reply. but shouldn't read() by itself work becaus

Re: [Tutor] Problem reading large files in binary mode

2014-06-13 Thread Mirage Web Studio
Thank you, i will keep all that in mind. My python version is 3.3.5 George On 13-06-2014 16:07, Peter Otten wrote: Mirage Web Studio wrote: Try reading the file in chunks instead: CHUNKSIZE = 2**20 hash = hashlib.md5() while True: chunk = f.read(CHUNKSIZE) if not chunk

[Tutor] usage difference between tabs and spaces

2014-09-09 Thread Mirage Web Studio
Hello, I am not an advanced programmer, but am very good with keyboard and find using tabs for syntax and formatting very helpful. But in this list and other python documentation i have repeatedly seen people recommending use of spaces. I know that i can use any of them and use tabs as my prefe

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Mirage Web Studio
Thank you and everybody else for the reply. I am using pycharm and i have found the way to produce four spaces for single tab key press. George On 10-Sep-14 2:32 AM, Danny Yoo wrote: I am not an advanced programmer, but am very good with keyboard and find using tabs for syntax and formatt

Re: [Tutor] help please

2018-10-10 Thread Mirage Web Studio
You are using the same variable name twice. You may use "rivers" for the dict and "river" for values. Also use descriptive names for variables. For eg if you correct the above mistake, the next one will be this line for rivers in rivers.values(): print (rivers) and sorry for top positing.