Re: [Tutor] Creating lists with 3 (later4) items occuring only once

2015-09-28 Thread Oscar Benjamin
On 27 September 2015 at 12:39, marcus lütolf wrote: > Hello Martin. > I never exspected to get such motivating comments and advice !!! Thank you > again. > Referring to my statments below > > 1. I explain my task in plain text: > Flights (in golfers language) or Triples (in computer language) com

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-28 Thread richard kappler
> > Hi Richard, > > Just to check: what operating system are you running your program in? > Also, what version of Python? > Hi Danny, using Linux and Python 2.7 > > > > ## > with open('input/test.xml', 'rU') as f1: ... > ## > > > Question: c

[Tutor] Python type confusion?

2015-09-28 Thread Ken Hammer
A simple "type" problem? The following code works as a py file with the XX'd lines replacing the two later "raw_input" lines. Why do the "raw_input" lines yield a TypeError: 'str' object is not callable? Same result if I use/omit the parens around the poly tuple. evaluate a polynomial

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: > A simple "type" problem? > > The following code works as a py file with the XX'd lines replacing the two > later "raw_input" lines. > Why do the "raw_input" lines yield a TypeError: 'str' object is not callable? > Same result if I use/omit >

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 4:13 PM, C Smith wrote: > On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: >> A simple "type" problem? >> >> The following code works as a py file with the XX'd lines replacing the two >> later "raw_input" lines. >> Why do the "raw_input" lines yield a TypeError: 'str'

Re: [Tutor] Python type confusion?

2015-09-28 Thread Danny Yoo
On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: > A simple "type" problem? > > The following code works as a py file with the XX'd lines replacing the two > later "raw_input" lines. > Why do the "raw_input" lines yield a TypeError: 'str' object is not callable? > Same result if I use/omit >

Re: [Tutor] Python type confusion?

2015-09-28 Thread Danny Yoo
> As C Smith notes, raw_input() returns a string. As the name suggests, > it treats its input as raw text, and does not try to interpret it as > data. Whoops! I slightly misspoke here: I mean to say that it does not try to interpret it as *structured* data. That is, we want things that look li

[Tutor] Custom Function that Takes argument

2015-09-28 Thread Nym City via Tutor
Hello, I am learning how to create custom functions and watched the tutorial online that uses API for locu to do cool stuff. I wanted to go little bit beyond the tutorial and add my own features. The problem that I am running into is that I cannot figure out how to prompt a user to input their z

Re: [Tutor] Custom Function that Takes argument

2015-09-28 Thread Alan Gauld
On 29/09/15 00:45, Nym City via Tutor wrote: I am learning how to create custom functions and watched the > tutorial online that uses API for locu Since most folks here probably don't know locu you should maybe give us a URL. Then we can know what it is you are talking about. I cannot figure

Re: [Tutor] Python type confusion?

2015-09-28 Thread Mark Lawrence
On 28/09/2015 21:27, Ken Hammer wrote: As you've all ready had answers I've just one thing to say below. total = 0.0 for i in range(len(poly)): totalTerm = poly[i]* (x ** i) total += totalTerm print "totalTerm ", i , totalTerm print "Equation Value", total Perhaps

[Tutor] skip/slice more than every second?

2015-09-28 Thread questions anon
a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14] how can I show the first then skip three and show the next and so on? For example: show 1 then skip 2,3,4 then show 5 then skip 6,7,8 then show 9 then skip 10,11,12, etc. Any feedback will be greatly appreciated.

Re: [Tutor] skip/slice more than every second?

2015-09-28 Thread questions anon
thankyou but I just realised I wrote the question wrong - how do I do the inverse of above so hide 1 show 2,3,4 hide 5, show 6,7,8 etc. thanks in advance On Tue, Sep 29, 2015 at 1:33 PM, Sebastian Cheung < sebastian_che...@yahoo.com> wrote: > print range(1,15,4) > > ans: [1, 5, 9,13] > > > > Se

Re: [Tutor] skip/slice more than every second?

2015-09-28 Thread Steven D'Aprano
On Tue, Sep 29, 2015 at 01:16:36PM +1000, questions anon wrote: > a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14] > > how can I show the first then skip three and show the next and so on? > For example: > show 1 > then skip 2,3,4 > then show 5 > then skip 6,7,8 > then show 9 > then skip 10,11,12, Here is

Re: [Tutor] skip/slice more than every second?

2015-09-28 Thread Steven D'Aprano
On Tue, Sep 29, 2015 at 01:54:44PM +1000, questions anon wrote: > thankyou but I just realised I wrote the question wrong - > > how do I do the inverse of above > so > hide 1 show 2,3,4 hide 5, show 6,7,8 etc. > > thanks in advance A little more tricky. The version I showed using iter() and a wh