Re: [Tutor] Huge list comprehension

2017-06-12 Thread Danny Yoo
On Sun, Jun 11, 2017 at 9:54 PM, syed zaidi wrote: > Thanks > One reason fornsharing the code was that I have to manually create over 100 > variables Don't do that. Anytime you have to manually repeat things over and over is a sign that you need a loop structure of

Re: [Tutor] Fahrenheit to Celsius Conversion with if else statements

2017-06-12 Thread William Gan
Good day Alan, Very much thanks for your guidance. I have added or 'c' to the if statement. That is resolved. Through that correction I discovered my C to F code was wrong. The + 32 is supposed to be executed at the end. Thanks again. Cheers -Original Message- From: Alan Gauld

[Tutor] decorators in a class

2017-06-12 Thread anish singh
Trying to use decorators in my class. I am calling build_tree from the main function and i want to increment the arguments by a constant factor by using decorators. However as build_tree is a recursive function, I don't want to call it recursively with increased constant factor always. Probably

Re: [Tutor] string reversal using [::-1]

2017-06-12 Thread Alan Gauld via Tutor
On 12/06/17 15:57, Vikas YADAV wrote: > for i in range(len(s)-1, 1, -2): > print s[i] > - > > So my question is: how would you write "s[::-1]" in terms of a for loop for > illustration purpose? Exactly as above but replace -2 with -1 for i in

Re: [Tutor] Creating 2 Subarrays for large dataset

2017-06-12 Thread Alan Gauld via Tutor
On 12/06/17 16:52, Peter Gibson wrote: > I have a large, 4 column data set that is in the form of an array. Do you mean 4 separate arrays or a single 4xN array? Or do you mean an N size array of 4 item tuples? Or are the 4 colums part of a class? There are lots of ways to interpret that

Re: [Tutor] Fahrenheit to Celsius Conversion with if else statements

2017-06-12 Thread Alan Gauld via Tutor
On 12/06/17 15:17, William Gan wrote: > print('Enter C for Celsius to Fahrenheit or F for Fahrenheit to Celsius.') > unit = input('Enter C or F:') > temp = int(input('Enter temperature:')) > > if unit == 'C': Note this only t5ests for 'C' - ie capital C. You might want to force the input to be

Re: [Tutor] Huge list comprehension

2017-06-12 Thread Alan Gauld via Tutor
On 12/06/17 05:54, syed zaidi wrote: > One reason fornsharing the code was that I have to manually create over 100 > variables > Is there a way i can automate thst process? I doubt very much that you *have* to create 100 varables, that's an implementation choice as part of your design. If you

Re: [Tutor] string reversal using [::-1]

2017-06-12 Thread Vikas YADAV
Thanks, Abdur for forwarding Steve's message. It is a very good explanation with examples. The following example does help: - py> s = "Nobody expects the Spanish Inquisition!" py> s[-1:1:-2] '!otsun snp h tex db' is somewhat like: for i in

[Tutor] Creating 2 Subarrays for large dataset

2017-06-12 Thread Peter Gibson
Hello, I have a large, 4 column data set that is in the form of an array. In the last column, there is either a 1 or a 2, and they are not organized in any predictable manner (ex of an array of the last columns: 1,2,2,1,2,2,1,1,1,1,2,1,1, ect). I would like to cut this large data set into two

[Tutor] Fahrenheit to Celsius Conversion with if else statements

2017-06-12 Thread William Gan
Good day Everybody, I am practicing coding when I encountered a problem with the if and else statements in my code. Hope someone can help me understand my mistake. The following is my code to convert Fahrenheit to Celsius and vice-versa: print('Enter C for Celsius to Fahrenheit or F for

Re: [Tutor] Huge list comprehension

2017-06-12 Thread syed zaidi
Thanks One reason fornsharing the code was that I have to manually create over 100 variables Is there a way i can automate thst process? Get Outlook for Android From: Abdur-Rahmaan Janhangeer Sent: Saturday, June 10, 3:35 PM Subject: Re: [Tutor] Huge list comprehension

Re: [Tutor] string reversal using [::-1]

2017-06-12 Thread Abdur-Rahmaan Janhangeer
[QUOTED ENTIRELY FROM STEVE {st...@pearwood.info} IN ANSWER TO A SLICING QUESTION] The way to think about string indexing and slicing is that the index positions mark *between* the characters. Take your string: Machine learning is awesome! For brevity, I'll just use the first word:

Re: [Tutor] Python - help with something most essential

2017-06-12 Thread Abdur-Rahmaan Janhangeer
i might add that with open( . . . instead of foo = open( . . . also shows some maturity in py Abdur-Rahmaan Janhangeer, Mauritius abdurrahmaanjanhangeer.wordpress.com On 11 Jun 2017 12:33, "Peter Otten" <__pete...@web.de> wrote: > Japhy Bartlett wrote: > > > I'm not sure that they cared

Re: [Tutor] Huge list comprehension

2017-06-12 Thread Abdur-Rahmaan Janhangeer
i think that you created 1000 vars as you needed them with different names replacing these with dictionary keys might be the answer if you hava a specific pattern for the variable, it'll be fine as it'll just be string manipulation e.g. variables ={ } then for i in range(..):

Re: [Tutor] tkinter actively maintained?

2017-06-12 Thread Alan Gauld via Tutor
On 12/06/17 03:54, Michael C wrote: > Hi all: > > is tkinter still being actively maintained? I only had to ask about this > because I have never looked stuff like this up before. Yes, Tkinter tracks the Tk releases so that most of the activity at present is in the ttk sub package. There is a

[Tutor] tkinter actively maintained?

2017-06-12 Thread Michael C
Hi all: is tkinter still being actively maintained? I only had to ask about this because I have never looked stuff like this up before. Is it ok to develop using it, is it going to be dropped in the near future? thanks! ___ Tutor maillist -