[Tutor] Defining a "format string"

2011-06-26 Thread Lisi
In the following excerpt from a program in the book I am following: print "If I add %d, %d, and %d I get %d." % ( my_age, my_height, my_weight, my_age + my_height + my_weight) is % ( my_age, my_height, my_weight, my_age + my_height + my_weight) the/a format string? If not, th

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 12:05 PM, Lisi wrote: > In the following excerpt from a program in the book I am following: > >   print "If I add %d, %d, and %d I get %d." % ( >      my_age, my_height, my_weight, my_age + my_height + my_weight) > > is > > % ( >      my_age, my_height, my_weight, my_age +

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Steven D'Aprano
Lisi wrote: In the following excerpt from a program in the book I am following: print "If I add %d, %d, and %d I get %d." % ( my_age, my_height, my_weight, my_age + my_height + my_weight) is % ( my_age, my_height, my_weight, my_age + my_height + my_weight) the/a format str

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Lisi
Thanks, Noah and Steven. :-) On Sunday 26 June 2011 12:24:12 Steven D'Aprano wrote: > Lisi wrote: > > In the following excerpt from a program in the book I am following: > > > >print "If I add %d, %d, and %d I get %d." % ( > > my_age, my_height, my_weight, my_age + my_height + my_weight

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 2:42 PM, Lisi wrote: > Thanks, Noah and Steven.  :-) > > On Sunday 26 June 2011 12:24:12 Steven D'Aprano wrote: >> Lisi wrote: >> > In the following excerpt from a program in the book I am following: >> > >> >    print "If I add %d, %d, and %d I get %d." % ( >> >       my_a

Re: [Tutor] Television

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 2:02 AM, Vincent Balmori wrote: > > It's working better now. The problem I have left is that I have to set the > channel and volume values in a range (for both I intend for 0-10). I thought > the range() would be the choice, but probably I'm not using it right. I think the

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Alan Gauld
"Lisi" wrote So, if I have now understood correctly, a format string is a string containing at least one variable, and the variable(s) is/are preceded by the % symbol. Yes??? Umm, nearly... The format string contains format specifiers. They are not variables. The specifiers define the type

Re: [Tutor] Defining a "format string"

2011-06-26 Thread Lisi
On Sunday 26 June 2011 17:15:14 Alan Gauld wrote: > "Lisi" wrote > Umm, nearly... > The format string contains format specifiers. They are not variables. > The specifiers define the type of data to be inserted into the string > as well as how the data will be formatted - hence the name. > > So you

Re: [Tutor] Television

2011-06-26 Thread Vincent Balmori
I made in elif statement for the channel changer that works for it, but the volume systems system boundary does not the way I want it to. If the volume is 2 and I lower it by a value of 5, it will accept the volume at a negative number thus going past the boundary. The vice-versa for the high boun

Re: [Tutor] Television

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 8:28 PM, Vincent Balmori wrote: > > I made in elif statement for the channel changer that works for it, but the > volume systems system boundary does not the way I want it to. If the volume > is 2 and I lower it by a value of 5, it will accept the volume at a negative > num

[Tutor] Critter

2011-06-26 Thread Vincent Balmori
I'm on the Critter Caretake problem that involves handling more than one critter. I have looked At David Merrick's threads for some answers, but the difference is that he created a whole new class to handle it, while I only made more critter objects. The only problem I have left is to have my acti

[Tutor] Class methods

2011-06-26 Thread David Merrick
Is it possible too have crit1 = Critter("Dave") crit2 = Critter("Sweetie") farm = [crit1,crit2] #List# and then be able to use Critters methods on farm? # Critter Caretaker # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, bore

Re: [Tutor] Class methods

2011-06-26 Thread Marc Tompkins
On Sun, Jun 26, 2011 at 7:12 PM, David Merrick wrote: > Is it possible too have > > crit1 = Critter("Dave") > crit2 = Critter("Sweetie") > farm = [crit1,crit2] #List# > > and then be able to use Critters methods on farm? > > No. farm is a list, and lists don't inherit the methods of the objects