Need help with programming in python for class (beginner level)

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Nov 30 01:59:16 CET 2013


On 30/11/2013 00:49, Johannes Findeisen wrote:
> On Sat, 30 Nov 2013 01:38:36 +0100
> Johannes Findeisen wrote:
>
>> On Fri, 29 Nov 2013 16:31:21 -0800 (PST)
>> farhanken at gmail.com wrote:
>>
>>> print "<p>The total rolled was: "number" </p>"
>>
>> The above line is wrong. You did it right below:
>>
>>> print "<p>Thanks for playing, "  + name +  ".</p>"
>>> print "<p>You bet the total would be at least " + value + ".</p>"
>>
>> Do this:
>>
>> print "<p>The total rolled was: " + number + " </p>"
>
> Sorry, that was wrong! You need to convert to a string when
> concatenating...
>
> print "<p>The total rolled was: " + str(number) + " </p>"
>

Wrong again, or at least overengineered.

print "<p>The total rolled was:", number, </p>"

You don't even need the spaces as print kindly does it for you :)

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list