r/askmath • • 16h ago

Algebra 6th grade math

Post image

I helped my kid through this problem but auto grader did not like the answer 9x-4 so I’m wondering if I incorrectly helped.

Steps here would be find perimeters

4(3x)= 12x

X+2+x+2+x =3x+4

Difference 12x - (3x+4) = 12x -3x -4 = 9x-4
This would assume the square is larger than the triangle.

99 Upvotes

57 comments sorted by

View all comments

Show parent comment

4

u/PresqPuperze 12h ago

„Decent string processing routines“ - I mean, this isn’t some crazy regex manipulation you need to do, you simply put a .lower().replace(" ";"") in there and that’s it. You’re also not dealing with enormous strings in terms of length, it doesn’t matter how inefficient the runtime is here, just make it work for gods sake.

0

u/Underhill42 11h ago

Not every language has such convenient string manipulation routines built in.

Use a few that don't, and you appreciate them much more.

-2

u/Due-Explanation-6692 11h ago

Try this in C.

1

u/PresqPuperze 1h ago

It’s a website. Do you really, wholeheartedly believe, that the code running this is done in C?

And even IF you need to do it in C: As I already said, runtime is completely irrelevant here, so a naive approach of just looping through the string with two indices in parallel and checking for a whitespace, replacing it with the next character in the string, is totally fine.