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
> book and so far I am e
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 (this is pseudo-code
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:
> print(
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 be
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 printing
it. so next iteration
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.
Yo
# 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()
g
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
i
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
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: guess < number
Traceback (mo
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 what is your name')
[ 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
12 matches
Mail list logo