Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60785

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

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Need help with programming in python for class (beginner level)
Date 2013-11-30 00:59 +0000
References <e9d18514-1da5-471a-bf39-5f67d3d8fef7@googlegroups.com> <20131130013836.49f68d62@hanez.org> <20131130014903.220759fa@hanez.org>
Newsgroups comp.lang.python
Message-ID <mailman.3412.1385773176.18130.python-list@python.org> (permalink)

Show all headers | View raw


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@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Need help with programming in python for class (beginner level) farhanken@gmail.com - 2013-11-29 16:31 -0800
  Re: Need help with programming in python for class (beginner level) Johannes Findeisen <mailman@hanez.org> - 2013-11-30 01:38 +0100
  Re: Need help with programming in python for class (beginner level) Eduardo A. Bustamante López <dualbus@gmail.com> - 2013-11-29 16:45 -0800
  Re: Need help with programming in python for class (beginner level) Johannes Findeisen <mailman@hanez.org> - 2013-11-30 01:49 +0100
  Re: Need help with programming in python for class (beginner level) Tim Chase <python.list@tim.thechases.com> - 2013-11-29 18:53 -0600
  Re: Need help with programming in python for class (beginner level) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-30 00:59 +0000
  Re: Need help with programming in python for class (beginner level) Tim Chase <python.list@tim.thechases.com> - 2013-11-29 19:06 -0600
  Re: Need help with programming in python for class (beginner level) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-30 01:08 +0000
  Re: Need help with programming in python for class (beginner level) Johannes Findeisen <mailman@hanez.org> - 2013-11-30 02:16 +0100
  Re: Need help with programming in python for class (beginner level) Julio Schwarzbeck <julio@techfuel.net> - 2013-12-01 17:01 -0800

csiph-web