Write a function called between_zero_and_onethat takes a parameter num; num will be a number at run time. The function should return True if num falls strictly between 0 and 1; otherwise, it should return False.
-If n is a multiple of d, that is, if "d divides n" evenly, the function returns True and prints a message. For example, if n is 12 and d is 2, the message will say, "12 is divisible by 2"
Write the code needed to get an integer from standard input. Then, write a simple decision statement that will output a message reporting whether the number is evenly divisible by 3, or by 5, or both, or neither. You might need about 10 lines of code.
Hint: Use the accumulate-a-product pattern as discussed in class. Remember, you should not initialize your accumulator variable to 0 when it represents a product.
Define a function count_negatives(L), which takes a list of numbers, L, as its parameter. The function returns an integer count telling how many of the items in L are negative (less than zero).
Define the function count_SPAM(L), which takes a list of strings, L, as its parameter. The function returns a count of how many times the word "SPAM" occurs as an item in L.
Write a short program, approximately 12 lines of code, to read a positive integer n from the keyboard, count the number of positive integer divisors of n, and print a message reporting that count. In addition, if n is prime, also print, "That’s a prime number!". HINT: A positive integer n is prime provided n has exactly two positive integer divisors, 1 and n.
For example, the divisors of 12 are 1, 2, 3, 4, 6, 12. There are 6 of them. If n = 12 is read from the keyboard, the program will print, "12 has 6 divisors."
By definition, F(1) and F(2) are both 1, while later terms are found by adding the previous two terms to make the next. Algebraically, we define F(N) as follows:
Think about how many additional terms the for loop needs to calculate to determine F(N) when N > 2. That number is the argument for the range function call in the first line of the loop.
In the body of the loop, update both accumulators: let nextbe the sum of previousand current, update previousto equal current, and update currentto equal next.