‘This is harder than I thought.’ Dakota mused, then said; “Shane is smart as a whip,” while watching Melody's face for her reaction. “I’m surprised he let me do this.”
1 Answer
Yes, you can. Same character, you can combine their thoughts, actions and spoken lines in their paragraph as you deem right.
Though if I might suggest two things...
One, I hate putting inner monologue in italics. If you notice, it's something that appears in internet archives where amateur writers post their stories, not so much in books. Most professional writers differentiate inner monologue (if written as direct speech) from talking out loud simply by not putting it in quotes. Which would make for:
This is harder than I thought, Dakota mused, then said, “Shane is smart as a whip,” while watching Melody's face for her reaction. “I’m surprised he let me do this.”
(You may note I changed the punctuation. The rules of punctuation are the same here as for direct speech, so speech tag after the line means the line will be ended with a comma instead of a period.)
Two, one other option, and quite a popular one, is to deliver inner monologues as semidirect speech instead. Assuming you're writing from a limited third-person perspective, which is by far the most common nowadays, there's no possible confusion about whose inner monologue it is. There's only one character whose thoughts we have access to, the one holding the point of view. (Of course, you wouldn't want to do this if your POV character isn't Dakota but a telepath reading his thoughts.)
This was harder than Dakota had thought. “Shane is smart as a whip,” he said while watching Melody's face for her reaction. “I’m surprised he let me do this.”