Creating a calculator

2016-06-30 Thread Elizabeth Weiss
while True: print("Options:") print("Enter 'add' to add two numbers") print("Enter 'subtract' to subtract two numbers") print("Enter 'multiply' to multiply two numbers") print("Enter 'divide' to divide two numbers") print("Enter 'quit' to end the prog

Iteration, while loop, and for loop

2016-06-28 Thread Elizabeth Weiss
I understand this code: words=["hello", "world", "spam", "eggs"] for words in words print(word + "!") What I do not understand is: words=["hello", "world", "spam", "eggs"] counter=0 max_index=len(words)-1 while counter<=max_index: word=words[counter] print(word + "!") counter=counte

Empty List

2016-06-26 Thread Elizabeth Weiss
Hi There, What is the point of this code?: word=[] print(word) The result is [] When would I need to use something like this? Thank you! -- https://mail.python.org/mailman/listinfo/python-list

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 12:17:23 AM UTC-4, Elizabeth Weiss wrote: > CODE #1: > > i=0 > while 1==1: >print(i) >i=i+1 >if i>=5: > print("Breaking") > break > > -- > I understand that i=0 and i will only be printed if

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 1:20:37 AM UTC-4, DFS wrote: > On 6/23/2016 12:17 AM, Elizabeth Weiss wrote: > > > CODE #1: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > > print("Breaking") > &g

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 1:06:09 AM UTC-4, Rustom Mody wrote: > On Thursday, June 23, 2016 at 9:47:23 AM UTC+5:30, Elizabeth Weiss wrote: > > CODE #1: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > >

Re: Break and Continue: While Loops

2016-06-26 Thread Elizabeth Weiss
On Thursday, June 23, 2016 at 12:49:30 AM UTC-4, Lawrence D’Oliveiro wrote: > On Thursday, June 23, 2016 at 4:17:23 PM UTC+12, Elizabeth Weiss wrote: > > > > i=0 > > while 1==1: > >print(i) > >i=i+1 > >if i>=5: > > print("Bre

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Elizabeth Weiss
On Wednesday, June 22, 2016 at 11:59:44 PM UTC-4, Steven D'Aprano wrote: > On Thu, 23 Jun 2016 01:12 pm, Larry Hudson wrote: > > > On 06/22/2016 12:42 AM, Lawrence D’Oliveiro wrote: > > [snip] > >> I feel that’s a needlessly complicated rule. It would have been simpler > >> if boolean operators (a

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Elizabeth Weiss
On Wednesday, June 22, 2016 at 3:42:24 AM UTC-4, Lawrence D’Oliveiro wrote: > On Wednesday, June 22, 2016 at 3:40:22 PM UTC+12, Elizabeth Weiss wrote: > > I am a little confused as to how this is False: > > > > False==(False or True) > > > > I would think it is

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Elizabeth Weiss
On Wednesday, June 22, 2016 at 3:15:02 AM UTC-4, Jussi Piitulainen wrote: > Christian Gollwitzer writes: > > > Am 22.06.16 um 05:40 schrieb Elizabeth Weiss: > >> I am a little confused as to how this is False: > >> > >> False==(False or True) > >

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Elizabeth Weiss
On Tuesday, June 21, 2016 at 11:59:37 PM UTC-4, Ben Finney wrote: > Elizabeth Weiss > writes: > > > Hi There, > > Welcome! Your questions are fine here, but you may like to know that we > also have a beginner-specific forum for collaborative tutoring > https://mail.

Re: Operator Precedence/Boolean Logic

2016-06-22 Thread Elizabeth Weiss
On Tuesday, June 21, 2016 at 11:59:37 PM UTC-4, Ben Finney wrote: > Elizabeth Weiss > writes: > > > Hi There, > > Welcome! Your questions are fine here, but you may like to know that we > also have a beginner-specific forum for collaborative tutoring > https://mail.

Break and Continue: While Loops

2016-06-22 Thread Elizabeth Weiss
CODE #1: i=0 while 1==1: print(i) i=i+1 if i>=5: print("Breaking") break -- I understand that i=0 and i will only be printed if 1=1 The results of this is 0 1 2 3 4 Breaking Why is Breaking going to be printed if i only goes up to 4? It does say if i>=5? Shouldn't this me

while Loops

2016-06-21 Thread Elizabeth Weiss
i=1 while i<=5: print(i) i=i+1 The result is: 1 2 3 4 5 Why is one of the results 5 since i=i+1? Should the maximum result be 4 since 4 +1=5? Thanks for your help! -- https://mail.python.org/mailman/listinfo/python-list

Operator Precedence/Boolean Logic

2016-06-21 Thread Elizabeth Weiss
Hi There, I am a little confused as to how this is False: False==(False or True) I would think it is True because False==False is true. I think the parenthesis are confusing me. (False==False) or True This is True. Is it because False==False? And True==False is not True but that does not