Re: [Tutor] unorderable types

2017-08-06 Thread boB Stepp
Curses! I screwed up my later insertion. I should have written in my footnote: On Sun, Aug 6, 2017 at 3:20 PM, boB Stepp wrote: > [1] An exception is "Beginning Python -- From Novice to Professional, > 3rd ed." by Magnus Lie Hetland, c. 2017. I recently acquired this

Re: [Tutor] unorderable types

2017-08-06 Thread boB Stepp
On Sun, Aug 6, 2017 at 1:23 PM, Mats Wichmann wrote: > Meanwhile, it is worth pointing out that while: (as with other python > loops) can take an else: clause, which is executed if the loop runs to > completion and was not exited via break. That means you could ALSO > write

Re: [Tutor] unorderable types

2017-08-06 Thread Mats Wichmann
On 08/06/2017 11:35 AM, boB Stepp wrote: > So these final two "if" groupings should be _outside_ your while loop: > > while guessesTaken < 6: > > > if guess_value == number: > print('good job, ' + myName + '! you guessed my number in', > guessesTaken, 'guesses!') > > else: >

Re: [Tutor] unorderable types

2017-08-06 Thread boB Stepp
On Sat, Aug 5, 2017 at 1:28 PM, Howard Lawrence <1019sh...@gmail.com> wrote: > # this is a guess number game. > import random > > guessesTaken = 0 > > print('hello! What is your name?') > myName = input() > > number = random.randint(1, 20) > print('Well, ' + myName + ', i am thinking of a number

Re: [Tutor] unorderable types

2017-08-06 Thread Cameron Simpson
On 06Aug2017 07:19, Alan Gauld wrote: On 05/08/17 19:28, Howard Lawrence wrote: if guess_value != number: number = str(number) print ('nope. the number i was thinking of was ' + number) There is the problem, you convert number to a str before

Re: [Tutor] unorderable types

2017-08-06 Thread Alan Gauld via Tutor
On 05/08/17 19:28, Howard Lawrence wrote: > if guess_value != number: > number = str(number) > print ('nope. the number i was thinking of was ' + number) There is the problem, you convert number to a str before printing it. so next iteration of the loop your if test fails.

Re: [Tutor] unorderable types

2017-08-05 Thread Howard Lawrence
# this is a guess number game. import random guessesTaken = 0 print('hello! What is your name?') myName = input() number = random.randint(1, 20) print('Well, ' + myName + ', i am thinking of a number between 1 and 20') while guessesTaken < 6: print('take a guess.') guess = input()

Re: [Tutor] unorderable types

2017-08-05 Thread Howard Lawrence
Typing the : print("type (guess_value)=", type (guess_value)) print("type (number)=",type(number) type (guess_value)= type (number)= == the code runs again then prints type guess_value =< class int> type number= = Now Traceback kicks in

Re: [Tutor] Unorderable types

2017-08-05 Thread Peter Otten
boB Stepp wrote: > Did the text of this error message change between Python 3.5 and 3.6? Yes: $ python3.5 -c '1 < ""' Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: int() < str() $ python3.6 -c '1 < ""' Traceback (most recent call last): File "", line

Re: [Tutor] Unorderable types

2017-08-05 Thread Cameron Simpson
On 04Aug2017 22:00, boB Stepp wrote: When I attempted to recreate his error message with the original code snippets he sent, I got something a bit different: py3: guess = input() 2 py3:

Re: [Tutor] Unorderable types

2017-08-04 Thread boB Stepp
On Fri, Aug 4, 2017 at 8:44 PM, Cameron Simpson wrote: > [ Back onto the tutor list. - Cameron ] > > On 04Aug2017 09:12, Howard Lawrence <1019sh...@gmail.com> wrote: >> >> This is the code from tutorial > > > Thank you. > >> import random >> guessesTaken =0 >> >> print ('hello

Re: [Tutor] Unorderable types

2017-08-04 Thread Cameron Simpson
[ Back onto the tutor list. - Cameron ] On 04Aug2017 09:12, Howard Lawrence <1019sh...@gmail.com> wrote: This is the code from tutorial Thank you. import random guessesTaken =0 print ('hello what is your name') myName =input () number = random.randint(1,20) print ('well, ' + myName + ', I