Answer:
Explanation:
The following code is written in Java and like requested prompts the user for a number to continue or a letter to exit. Then loops and keeps adding all of the numbers to the sum variable and adding 1 to the count for each number entered. Finally, it prints the sum and the average using printf and the variables.
import java.util.Scanner;
class Examine1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int sum = 0;
int count = 0;
System.out.println("Enter a number to continue or a letter to exit.");
while(in.hasNextInt()) {
System.out.println("Enter a number:");
sum += in.nextInt();
count += 1;
}
System.out.printf("The sum is %s.%n", sum);
System.out.printf("The average is %s.", (sum / count));
}
}
Answer:
Explanation:
- We declare the variable about the zoo with the owl's quantity, we could put any integer.
- We make the sum operation zooA + zooB, with the variable total_owls.
- we print the result about the two zoo.
num_owls_zooA= 3
num_owls_zooB = 4
total_owls = 0
total_owls = num_owls_zooA + num_owls_zooB
print('Number of owls:', total_owls)
Answer:
The result of the following code will be 9
Explanation:
There are several operators used in Python to do mathematical calculations.
** operator is used for exponents.
i.e.
a ** b mathematically means a^b
Here in the given code
3 is assigned to numA and 2 is assigned to numB
Result will be equal to 3^2
Hence,
The result of the following code will be 9
True, but it won't be in the same namespace. See below:
>>> import time
>>> print time.time()
1510180694.04
>>> quit()
By doing a straight import I have to reference the namespace time and the function time. (Yeh, I should have picked a different example, but I couldn't think of any)
>>> from time import time
>>> time()
1510180718.76834
>>> quit()
By doing the from, I import the time function into the __main__ namespace so I don't need to reference a name space when I call it.
T, 0-60 in 5 is slow, 0.85 g is not a lot, and 168 feet is a lot of space to stop a car from 70 MPH, also it depends on what car it is. if its a lotus, they lied, if it is a civic si, possible, if its a corvette, no problem, if its a mustang, possible, if its a camaro, possible, also depends on the year, if its a 1908 ford model t, hold on to a clock with out second hand to get to 60