>
> > I am caught off guard but what is the purpose of the plus sign?  I don't
> recall seeing it used like that.
>

The + sign there is used for concating two strings together, for example -

output = 'foo' + 'bar'

Will give the variable output the value of the characters 'foobar'. This
also works with mixed values of variables holding strings and raw strings,
for example -

foo = 'foo'
output = foo + 'bar'

Which gives the same output as my previous example.

To OP:

I would not use the method you have used, but rather use string formatting,
so I would use on line 10 -

print 'Well, %s, I am thinking of a number between 1 & 20.' % (myName)

And on line 30 (which won't need the str(guessesTaken) on line 29) -

print 'Good job, %s! You guessed the number in %d guesses!' % (myName,
guessesTaken)

And then finally on line 34 -

print 'Nope. The number I was thinking of was %d' % (number)


By the way, for readability, tryToavoidCamelCase.
I also recommend you look into functions, classes, and exceptions - this
example is a good one with a lot of room to grow :)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to