23 posts
Posted 16 February 2013 - 07:58 AM
How would you go about doing the following without error?
print("Type "exit" To Exit")
212 posts
Location
Leeds, England
Posted 16 February 2013 - 08:16 AM
simple fix, use this
print('Type "exit" to exit')
There's two types of string syntax for printing, there the single quote ' and double quote " if you want to print a double quote the surround the rest of the string in a single quote and visa versa
Hope this helps you
758 posts
Location
Budapest, Hungary
Posted 16 February 2013 - 08:34 AM
And of course you can just escape it
print("this is a quotation mark: \" - what a surprise!")
1688 posts
Location
'MURICA
Posted 16 February 2013 - 08:43 AM
I'll go ahead and add that you can use double brackets too. They're best for strings in multiple lines, and maybe if you want to use both double and single quotes.
s = [[ a string
with mutiple lines
with 'single' and "double" quotes! ]]
23 posts
Posted 16 February 2013 - 08:47 AM
Thx guys everything you posted is helpful.