Answer:
The solution code is written in Python
- def max(a, b):
- if(a > b):
- return a
- else:
- return b
-
- num1 = int(input("Please input the first number: "))
- num2 = int(input("Please input the second number: "))
-
- print(max(num1, num2))
Explanation:
Firstly create a function max that accepts two input, a and b, as required by question (Line 1). In the function, create if statement to check if a greater than b return a and vice versa (Line 2 -5).
In the main program (Line 7 - 10), prompt user to input two numbers (Line 7 - 8). At last call the function by passing num1 and num2 as arguments and print the result (Line 10).
The answer is the first one
Answer:
I am writing the Python program. Let me know if you want the program in some other programming language. Here is the Python code:
class Student(object):
def __init__(a,score=10):
a.score=score
def add_score(a,score):
a.score += 10
return (score)
def decrease_score(a,score):
a.score -=10
return (score)
def __str__(a):
current_score="{}".format(a.score)
return current_score
Explanation:
The program has a Student() class with attribute score.
It has the following methods:
__init__(): This method works as a constructor and enables to initialize score attribute of Student class. The value of score is initialized to 10. I have used a as the instance of Student class. However self keyword can also be used as an instance of the object to access the attributes and methods of Student class.
add_score() This method is used to add 10 to the score.
decrease_score() This method is used to decrease the score by 10.
__str__() This method is used to return the current score. format() is used here to return a string. current_score holds the value of the current score.
If you want the check the working of the program, then you can use the following statements to see the results on the output screen:
p = Student()
print(p)
p.add_score(p)
print(p)
This will create an object p of Student class and calls the above methods to display the values of the score according to the methods.
The program along with its output is attached.
Answer:
int i = 0; i < names.size(); i++
Explanation:
The ArrayList must be read in the forward direction, and it is going to start from 0 certainly. Also, the iteration is going to end when i is exactly one less than the size of the ArrayList. And this is possible only if we choose the option mentioned in the Answer section. In this, i starts from 0 and iterates till i is one less than name.size() which is the size of the ArrayList.
Answer:
Priming.
Explanation:
The brain is the centre of control for all animals. It coordinates the body system, breathing, beating of the heart, memory, gait, speech, sight etc.
Memory is stored in the brain ( the function of the cerebral cortex in the cerebrum). Two types of memory are the long term and the short term memory. The long term memory stores information permanently in the brain, while the short term holds the information for a while and either transfers it to the long term memory or the memory decays.
To retrieve a specific memory from the wide memory of the brain, it activates a strand that leads to the memory, this process is called priming.