Re: Newbie coding question - format error

2014-06-29 Thread Martin S
Thanks for the input. The main thing was that the replacement fields were only valid for their local environment. /martin On 29 Jun 2014, Terry Reedy wrote: >On 6/29/2014 3:06 AM, Martin S wrote: > >A couple of additional notes: > >> x=int(input('Enter an integer ')) >> y=int(input('Enter ano

Re: Newbie coding question - format error

2014-06-29 Thread Martin S
Thanks for the input. The main thing was that On 29 Jun 2014, Terry Reedy wrote: >On 6/29/2014 3:06 AM, Martin S wrote: > >A couple of additional notes: > >> x=int(input('Enter an integer ')) >> y=int(input('Enter another integer ')) >> z=int(input('Enter a third integer ')) >> formatStr='Intege

Re: Newbie coding question - format error

2014-06-29 Thread Terry Reedy
On 6/29/2014 3:06 AM, Martin S wrote: A couple of additional notes: x=int(input('Enter an integer ')) y=int(input('Enter another integer ')) z=int(input('Enter a third integer ')) formatStr='Integer {0}, {1}, {2}, and the sum is {3}.' When the replacement fields and arguments are in the same

Re: Newbie coding question - format error

2014-06-29 Thread Roy Smith
In article , Sibylle Koczian wrote: > Am 29.06.2014 09:06, schrieb Martin S: > > IndexError: tuple index out of range > > > > {0} ... {3} are just placeholders in your format strings, they can't > exist outside of them. And you can't put more placeholders into the > format string than you've

Re: Newbie coding question - format error

2014-06-29 Thread Sibylle Koczian
Am 29.06.2014 09:06, schrieb Martin S: x=int(input('Enter an integer ')) y=int(input('Enter another integer ')) z=int(input('Enter a third integer ')) formatStr='Integer {0}, {1}, {2}, and the sum is {3}.' equations=formatStr.format(x,y,z,x+y+z) print(equations) formatStr2='{0} divided by {1} is