Write a program which will read a positive integer k from standard input. Use the listfunction and the rangefunction to print a list of integers from the given integer k down to 0.
Hint: When we give the range function 3 arguments, the third argument is the "step size". A negative step size allows us to count down. For example, range(10, 1, -2) is the sequence 10, 8, 6, 4, 2.
Write a program which will read two integers, j and k, from standard input. Use the listfunction and the rangefunction to print a list of integers from k down to j (inclusive).
Write a program which will read an integer k from standard input. Use the listfunction and the rangefunction to print a list of the even integers from -10 up to k (inclusive).
NOTE: If k is less than -10, your range command should automatically produce an empty sequence, resulting in an empty list being printed.Β See the provided examples.
Define a function print_multiples(m) that takes a positive integer parameter, m, and prints all the multiplesof m which areΒ between 1 and 100, inclusive.
Hint:The first number is 1. The next number (if there is a next number) is 1 + k. Then 1 + k + k, etc. What is the step size for this use of the range function?
Write the code needed to get integers j and k from standard input, then use a for loop to print out all the integers from j through k. You can assume that k will be more than j.
Hint: You need to use a for loop to iterate over a specific sequence of integers. Start by determining a correct call to the range function to create that sequence.
Write the code needed to get two integers, j and k, from standard input. Using a for loop and the range function, "count" by twos from j to k (inclusive), one integer per line. You may assume that j is less than or equal to k.
The function summit takes two integer parameters, start and stop, and returns the sum of all integers from start to stop, inclusive.Β For example, summit(-2, 3)returnsthe value of -2 + -1 + 0 + 1 + 2 + 3, which is 3. You may assume that start <= stop.
The function summation takes a positive integer n and returnsthe sum of all the odd integers from 1 through n.Β For example, summation(5) returns 9 since 1 + 3 + 5 equals 9.
Note: n will be a positive integer. For example, when n is 3, the return value is 1/2 + 1/4 + 1/8 (the result from adding the first three terms), which equals 0.875.
Hint: Each denominator is twice as large as the previous denominator. The nth denominator is \(2^n\text{.}\) You might solve this problem using two accumulators: acccould be the accumulated sum so far, and denomcould be the value for the denominator of the next term to be added.