could someone please tell me how i should correct this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

could someone please tell me how i should correct this?

message <- "Everything you can imagine is real." - Picasso print(message)

16th Oct 2021, 9:32 AM
Tree
Tree - avatar
24 Answers
+ 3
cat("\"Everything you can imagine is real.\" - Picasso")
16th Oct 2021, 10:01 AM
Simon Sauter
Simon Sauter - avatar
+ 4
Now you're missing the quotation marks that are part of the string. The escape character you need is \"
16th Oct 2021, 9:42 AM
Simon Sauter
Simon Sauter - avatar
+ 2
The whole string has to be in quotation marks. You have to use escape characters for the quotation marks that are part of the string.
16th Oct 2021, 9:37 AM
Simon Sauter
Simon Sauter - avatar
+ 2
Almost. You need another escape character at the beginning of the string.
16th Oct 2021, 9:49 AM
Simon Sauter
Simon Sauter - avatar
+ 2
Not quite. Now you're missing the opening quotation mark of the string.
16th Oct 2021, 9:52 AM
Simon Sauter
Simon Sauter - avatar
+ 2
cat() doesn't return anything (NULL). Therefore it doesn't make much sense to assign it to a variable.
16th Oct 2021, 1:24 PM
Lisa
Lisa - avatar
+ 2
i hope you got a help
16th Oct 2021, 6:52 PM
Jasy Fabiano
Jasy Fabiano - avatar
+ 1
No. I wrote it in a single line without using a variable.
16th Oct 2021, 11:08 AM
Simon Sauter
Simon Sauter - avatar
+ 1
I did above, it's the code that starts with "cat".
16th Oct 2021, 11:13 AM
Simon Sauter
Simon Sauter - avatar
+ 1
thank you very much for your help. it worked:)
16th Oct 2021, 11:15 AM
Tree
Tree - avatar
+ 1
message = '"Everything you can imagine is real." - Picasso' print (message)
16th Oct 2021, 12:49 PM
Vishal Sharma
Vishal Sharma - avatar
0
thanks. I did that but it does not accept it: message <- "Everything you can imagine is real/ - Picasso" print(message)
16th Oct 2021, 9:40 AM
Tree
Tree - avatar
0
you mean like this: message <- "Everything you can imagine is real\" - Picasso" print(message) the result is different.
16th Oct 2021, 9:46 AM
Tree
Tree - avatar
0
correct? message <- \"Everything you can imagine is real\" - Picasso" print(message)
16th Oct 2021, 9:51 AM
Tree
Tree - avatar
0
this one? message <- "\"Everything you can imagine is real\" - Picasso" print(message)
16th Oct 2021, 9:53 AM
Tree
Tree - avatar
0
Yes, that's it.
16th Oct 2021, 9:54 AM
Simon Sauter
Simon Sauter - avatar
0
doesn't accept. the result is different
16th Oct 2021, 9:55 AM
Tree
Tree - avatar
0
The dot after "real" is missing.
16th Oct 2021, 9:57 AM
Simon Sauter
Simon Sauter - avatar
0
ok but the result is: "\" every.... real. \"- picasso
16th Oct 2021, 9:59 AM
Tree
Tree - avatar
0
it is almost correct but at the end i have picassoNULL
16th Oct 2021, 10:04 AM
Tree
Tree - avatar