<u>Answer:</u>
<em>1. The loop will run unless the value of answer equals to Capital N.</em> The method equals is “case-sensitive” that is lower case letter and upper case letters are considered different. That “a” and “A” means the same to us, but for the method equals it is different and equals method will return false if the case is not matching.
<em>2. a (int)(Math.random() * (upper − lower) ) + lower </em>
Since we need to consider the lower limit value together to get the desired results we need to add the value of lower limit to the multiplied answer.
<em>3. b while(userGuess != secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)</em>
Here the program is required to check the while loop and exit when user guess the number or we can say the loop should continue until the user guess the number, so that is why we have taken <em>userGuess!=secretNumber. </em>Next the loop should be exited if it is not within the range or we can say that the loop should run only if the guessed number is within the upper and lower limit.<em> That is why we have opted for the condition userGues>=lowerlimit && userGuess<=upperlimit.</em> Why we have taken && as the operator is that, it’s a range of values so && operator best suit for this kind of logical condition.
Computers can be used for numerous things haha for one, research, games, connection from distances, and homework.
If you want more information because this one doesn't suffice, private message me or comment and I will fulfill your request!
Answer:
def max_list(a):
return max(a)
def max2(a,b):
return max(a,b)
s=max2(2,3)
print('max of two number is:')
print(s)
a=[1,2,3,4,5,6,7,8,9,10]
max_in_list = max_list(a)
print('\n max element in whole list is:')
print(max_in_list)
Explanation:
Above program is written in python:
Function max2 accept two parameters and return one which is greatest of both and funtion max_list accept a parameter list and returns the greatest number in list.
Note: take care of indentation of function while pasting this code on your compiler or ide