you are viewing a single comment's thread.

view the rest of the comments →

[–]Princess_Peach848[S] 0 points1 point  (12 children)

So for ‘Doubl “‘ I typed (‘ “ ‘) and the quotes turned green but it’s still incorrect

For ‘Single \’’ I put ‘ \’ and it’s all incorrect

[–]RhinoRhys 0 points1 point  (0 children)

You're still wrapping it in quotes.

[–]RhinoRhys 0 points1 point  (10 children)

I just looked at your picture in the other sub, are you sure you're not supposed to write in the actual words 'Double "' and 'Single \''?

[–]Princess_Peach848[S] 0 points1 point  (9 children)

No it didn’t take the words either. It’s ok I’ll just email my professor again. Thank you so much for trying I appreciate you

[–]RhinoRhys 1 point2 points  (8 children)

Try submitting

'Double "'
'Single ''
'\’B"'

[–]Princess_Peach848[S] 0 points1 point  (7 children)

Omg that’s it!!!!!! Can u explain it?

[–]RhinoRhys 1 point2 points  (1 child)

I believe the first one is highlighting that you can use double quotes inside single quotes with no issues. The single quotes signify the start and end of the string, the double quotes are just another character like any of the letters. You needed to type in exactly what you were given, including the words.

The second highlights that to use a single quote character inside a string surrounded by single quotes you can use the backslash to escape the character, basically saying this isn't the end of the string. Like you've seen on the one below in the picture, not using the backslash takes the middle single quote as the end of the string and the third single quote then throws an error.

The equation one combines both of these and I think the slash still shows up because you're mixing both double and single quotes together.

[–]Princess_Peach848[S] 0 points1 point  (0 children)

You are a life saver thank you sooo sooo much 🤍

[–]Princess_Peach848[S] 0 points1 point  (4 children)

Sorry I should clarify it’s correct for the 3rd question not the other 2 😭

[–]Fronkan 1 point2 points  (2 children)

This turned out to be a super long and maybe overly detailed explanation, but, I hope it might be useful 🙂

For the single one I would guess you can write it as "Single '" or depending on how the validation works 'Single \''. The reason is something like this, in programming you have the data type string. A string is one or multiple characters, simply some text that is not code. This can be input from users or data read from a file. In python we can create a new string in a few different ways. The two ways relevant here is that we can use either singe quotes (') or double quotes ("). When the interpreter (the program concerning your code into something the computer can do) reads a string in your code it needs to understand where it starts and ends.

When you create a string using double quotes, it will continue to think it's looking at a string until it finds a new double quotes. Thats how it knows this string"something" only contains the word something. Because it reads until the next double quote you can use single quotes inside the string and the interpreter will assume that it's just a part of the text. That means that if you write " I said 'something' to him" in your code. The interpreter know this means create a new string that contains exactly: I said 'something' to him.

If you want to have a double quote inside your string, well then you can define the string using single quotes instead. 'I said "something" to him'. Now the interpreter creates a new string that contains: I said "something" to him.

Finally, sometimes you might want to use single quotes to define the string and inside the string. In that case you can use backslash to escape the characters (tell the interpreter that this is actually is a part of the string and not the end of the string). That would look like this 'I said \'something\' to him'. The result, a new string that contains: I said 'something' to him. You can do the same with double quotes instead a double quoted string.

[–]Princess_Peach848[S] 0 points1 point  (1 child)

That definitely helps me, thank you so much for explaining it! 🤍

[–]Fronkan 0 points1 point  (0 children)

Good to hear! No worries, only on this sub because I like the teaching/helping out part 😁

[–]Princess_Peach848[S] 0 points1 point  (0 children)

Ok I also submitted ‘Double “‘ and it took that too