With math and order of opperations stuff.... its just easier to just use a lot of parentheses for readability sake. c= a + (B*2) Total = Meal + (Meal * tip) Granted this can be simplified in this case by Total = Meal * Tip+1 but thats just harder to understand whats happening.
DO NOT WORRY ABOUT OPTIMIZED CODE. Nothing needs to be optimized until it actually becomes a problem. I have wasted a ton of time on projects because i was trying to optimize my code early on making it harder to read and the optimizations are very negligible 99% of the time. When you need to optimize , its more likely that you need better logic instead of these little things. SO yeah... make things easy and readable first. If need be, clean it up later.
With counts and stuff, its weird and you need to know which way its going about it. If you do a length, it could start with 0 instead of 1. So, x= [1,2,3] gives x.length = 2. while x.count() = 3 . As they said, spaces and newlines count. I doubt you need to worry about this, but encoding can also come into play where you have single and double byte characters.... not sure what that would effect, but it is something.