#Help with mission
1 messages · Page 1 of 1 (latest)
Hey, @tight oar!
Please remember to /close this post once your question has been answered!
@tight oar how about storing the temps into a list, and then iterating over the list and getting the differences; if the difference is positive (warmer) then put it into a list for example
also why is the output 3, 4, 7 for 25,22,26,27,27,23,29? i sort of don't get the question
25-22 is 3 (cooler), 27-23 is 4 (cooler), but what's the 7 for? and isn't it asking about warmer days?
Because in the 3 the temp was warmer rhe day 2 Becausein day 2 the temp was 22 and in day 3 the temp was 26.
you understand now?
oh 3, 4, 7 are the days that were warmer, sorry i get it now
ok so store temps into a list of temps (for example), iterate over temps, and if day i's temp was cooler than i+1's temp, add i+1 to a list of warmerDays, then at the end just print the warmerDays list
Is it possible to do the code without the list command?
I guess you could save it as a String[], and do it that way. But most of academia isn't about coding, per se, and more about problem solving.
For example, you could solve 2 + 2 = 4 as 1 + 1 + 1 + 1 or 2 + 2 or 2 + 1 + 1 or 3 + 1.
You're going to get the same answer regardless, but if your teacher wants you to do 1+1+1+1 instead of 2+2 to get 4, it would benefit you more to figure that out on your own. I mean that in earnest.
Yes, you can use arrays instead as Kujo suggested above