Answer:
# Instead of repeating code over and over
forward(10)
left(90)
forward(10)
left(90)
forward(10)
left(90)
forward(10)
left(90)
# Use a for loop to repeat the code!
for i in range(4):
forward(10)
left(90)
# You can use the i variable inside the loop
# i starts at 0, and goes up to COUNT-1
# This will make Tracy move forward 0, then 1, then 2
for i in range(3):
forward(i)
# You can change the value of i inside a for loop by using mathematical expressions
for i in range(3):
forward(i*10)
# You can also control the value of i by using extended parameters
for i in range(STARTING_VALUE, ENDING_VALUE, INCREMENT):
# This will move Tracy forward 25, 50, and 75 pixels
for i in range(25, 76, 25):
forward(i)
love you guys <3
Answer:
The power function can be written as a recursive function (using Java) as follows:
- static int power(int x, int n)
- {
- if(n == 0){
- return 1;
- }
- else {
- return power(x, n-1 ) * x;
- }
- }
Explanation:
A recursive function is a function that call itself during run time.
Based on the question, we know x to the 0th power is 1. Hence, we can just create a condition if n = 0, return 1 (Line 3 - 5).
Next, we implement the logic "x to the nth power can be obtained by multiplying x to the n-1'th power with x " from the question with the code: return power(x, n-1 ) * x in the else block. (Line 6 -8)
In Line 7, power() function will call itself recursively by passing x and n-1 as arguments. Please note the value of n will be reduced by one for every round of recursive call. This recursive call will stop when n = 0.
Just imagine if we call the function as follows:
int result = power(2, 3);
What happen will be as follows:
- run Line 7 -> return power(2, 2) * 2
- run Line 7 -> return power(2, 1) * 2
- run Line 7 -> return power(1, 0) * 2
- run Line 4 -> return 1 (Recursive call stop here)
Next, the return value from the inner most recursive call will be return to the previous call stack:
- power(1, 0) * 2 -> 1 * 2
- power(2, 1) * 2 -> 1 * 2 * 2
- power(2, 2) * 2 -> 1 * 2 * 2 * 2 - > 8 (final output)
Answer: independence
Explanation:
The AICPA Code of professional Conduct is based on the following concepts which are :
1. responsibilities
2. serve the public interest
3. integrity
4. objectivity and independence
5. due care
6. The scope and nature of services.
The answer is D. It's asking for the most UNETHICAL not ETHICAL, the answer before me was ETHICAL. Sharing personal data is UNETHICAL.
Answer:
System software.
Explanation:
System software are the in-built functions that perform a particular pre-defined task when used in a computer program. An example of a system software is an operating system.
An operating system (OS) is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes. Some examples of an operating system are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.