Answer:
- common = []
- num1 = 8
- num2 = 24
- for i in range(1, num1 + 1):
- if(num1 % i == 0 and num2 % i == 0):
- common.append(i)
- print(common)
Explanation:
The solution is written in Python 3.
Firstly create a common list to hold a list of the common factor between 8 and 24 (Line 1).
Create two variables num1, and num2 and set 8 and 24 as their values, respectively (Line 3 - 4).
Create a for loop to traverse through the number from 1 to 8 and use modulus operator to check if num1 and num2 are divisible by current i value. If so the remainder of both num1%i and num2%i will be zero and the if block will run to append the current i value to common list (Line 6-8).
After the loop, print the common list and we shall get [1, 2, 4, 8]
Answer:
In Python:
def gcd(m,n):
if n == 0:
return m
elif m == 0:
return n
else:
return gcd(n,m%n)
Explanation:
This defines the function
def gcd(m,n):
If n is 0, return m
<em> if n == 0:
</em>
<em> return m
</em>
If m is 0, return n
<em> elif m == 0:
</em>
<em> return n
</em>
If otherwise, calculate the gcd recursively
<em> else:
</em>
<em> return gcd(n,m%n)</em>
<em />
<em>To call the function to calculate the gcd of say 15 and 5 from main, use:</em>
<em>gcd(15,5)</em>
This is an incomplete question. The complete question is given below:
Mike has never used slide presentation software before but he needs to create a presentation by the end of the week what resource would be most helpful to mike
a. The 350-page printed manual from the slide presentation software publisher
b. A free tutorial the slide presentation software publisher has posted on the company website
c. A trouble-shooting website created by a third party
d. The 350-page online manual from the slide presentation software publisher
Answer:
b - A free tutorial the slide presentation software publisher has posted on the company website
Explanation:
As Mike has a short time and no prior experience with a slide software, then in this scenario, the best, simplest and fastest way to learn and create a presentation a free tutorial which the slide presentation software publisher has posted on the company website as this is the same company that has created this particular software so he can be rest-assured that the resource he is relying on is authentic and up-to-date with information on latest features.
Moreover, it's efficient and quick way to learn from a free tutorial rather than from 350-page printed or online manual especially for a beginner.
Besides, his purpose is to create the presentation using the software and not trouble-shooting so trouble-shooting website created by a third party is not useful for him and it also might not be authentic or updated as well.
Answer:
true
Explanation:
I think that's what it has been in my time of classes
Answer:
//class Name
class Name {
// attributes gave you 3
String first_name;
String last_name;
int length = 0;
//constructor with 2 parameters
Name(String first_name, String last_name){
}
//methods
public String find_printed_name(){
return first_name + " " + last_name;
}
public void find_sortable_name(){
return last_name + ", " first_name.charAt(0);
}
public static void main(String[] args){
// instantiate the class
Name test_name = new Name("David", "Joyner");
System.out.println(test_name.first_name);
System.out.println(test_name.last_name);
System.out.println(test_name.find_printed_name());
System.out.println(test_name.find_sortable_name());
}
Explanation:
You didn't specify a language so I did it in Java.
You should know how to declare methods in Python.