Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What\'s wrong with my code???? -------------- Question: The squirrels in Palo Al

ID: 674105 • Letter: W

Question

What's wrong with my code????

--------------

Question:

The squirrels in Palo Alto spend most of the day playing. In particular, they play if the temperature is between 60 and 90 (inclusive). Unless it is summer, then the upper limit is 100 instead of 90. Given an int temperature and a boolean is_summer, return True if the squirrels play and False otherwise.

squirrel_play(70, False) True
squirrel_play(95, False) False
squirrel_play(95, True) True

My Code:

def squirrel_play(temp, is_summer):
if temp>=60 and temp<=90:
return True
elif is_summer>=60 and is_summer<=100:
return True
else:
return False

Explanation / Answer

Here is theerror in your code part

public boolean isPlaying(int temp, boolean isSummer)
{
if(isSummer && temp>=60 && temp<=100)
return true;
else if (temp >=60 && temp <=90)
return true;
else
return false;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote