I tried to work through the Sorted Studio on my own and passed the last two test conditions. But, I knew it would fail for the first condition (“ABC”, True). Is there a way to use the ord function to convert the following characters, ‘B’ and ‘C’, in my if statement? Or am I approaching it the wrong way and need to do conversions or add another for loop to my code? I apologize if I’m not supposed to ask questions about studios online. I didn’t get the chance to ask about the studio in class today.
Not sure if I am addressing your point-- but there should be a way to indicate, with a boolean variable, whether a set is sorted or not, and, after a pass through all of the elements, to affect this variable based on whether or not any numbers were “swapped”. The boolean variable can then be referenced to decide whether or not to continue the sorting loop.
I think I’m getting what you are saying. Would I iterate through the characters of the string, get their ordinal values, then set a statement that checks if the set is sorted? I’m probably still thinking about it wrong lol.
That sounds good, though you may not need the ordinal values. Remember that string elements are still sortable-- each character can be compared with another, using < and > operators.