python - pycharm exercise "Character Escaping": task completed but wrong syntax -


i'm following built-in tutorial in pycharm edu edition , i'm stuck on strings - character escaping. in exercise i'm asked print following: name of ice-cream "sweeet'n'tasty" using character escaping, , here's code:

print("the name of ice-cream \"sweeet\'n\'tasty\"") 

and still gives me "sorry wrong string printed". don't think printed wrong string. help?

you have escape " because use in print ' not need protected.

printing "\'n" , "'n" output same line escape, if not visible, generate read exercise controller.

try removing \ before '

print("the name of ice-cream \"sweeet'n'tasty\"") 

another solution string containing " or ' use triple " this:

print("""the name of ice-cream "sweeet'n'tasty\"""") 

in case, fact sentence terminated " force protect again, " in middle not need protected.

you can invert use of ' , " protect ' or "

print('the name of ice-cream "sweeet\'n\'tasty"') 

and use of 3 ' possible too:

print('''the name of ice-cream "sweeet'n'tasty"''') 

if still don't work, provide assert test ?

edit:

this seems issue facing: http://iswwwup.com/t/d08b1b05234e/print-out-text-using-one-string-in-python.html

comes ambigous test requirement / ide behaviour.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -