[Tutor] adding quotation marks around variables
Brian van den Broek
bvande at po-box.mcgill.ca
Mon Jul 11 00:47:06 CEST 2005
Robert said unto the world upon 10/07/2005 17:31:
> Hello all, I am a college student and I am currently working on a two numbers program for our class, The purpose of this program is to take user input and do some math functions.
>
> I have figured out how to do the math but I need to display these two variables with quotation marks around them.
>
> Also I need to add these two variables together and display the hexadecimal of these two variables???
>
> Also how do you display wheather one variable is greater than or less than or equal to the other variable?
>
>
> Below is an example of the items i need help with?
>
>
>
>
> The two numbers were "X" and "Y."
>
> The first number was (< > =) the second number.
>
> The hexadecimal sum of the two numbers is XXX.
>
> Any help with this would be gratly appreciated!
> Thanks
> Robert
>
Darn, overlooked the desire to embed quotes:
>>> print "Formated strings can %s like this ', too" %"include"
Formated strings can include like this -too
>>> print 'or %s %s"' %('like', 'this')
or like this"
>>> print '''Or both %s -- ' and " -- if %s''' %('kinds of quotes',
'you use triple-quote strings')
Or both kinds of quotes -- ' and " -- if you use triple-quote strings
>>>
Brian vdB
More information about the Tutor
mailing list