[SOLVED] HSMW Exercise

25.00 $

Category:

Description

Rate this product

Develop the function sum_loop( start , end) where it return the sum of all integers between

“start” up to “end” using a loop. Develop the function sum_recursion( start , end) where it

return the sum of all integers between “start” up to “end” using recursion. In both cases,

check that “start” is less than or equal to “end” otherwise return None.

Develop the function sumDigits_loop( number ) where it return the sum of all the digits of

the integer stored in “number” using a loop. Develop the function

sumDigits_recursion( number ) where it return the sum of all the digits of the integer stored

in “number” using recursion. In both cases, check that “number” is a valid positive integers.

In case of error, return None.

Develop the function isPrime( number ) where it return true if number s prime otherwise

return false. Using module “sympy”, implement the function isPrime_sympy with same

functionality.

Develop the function sumDivisible( start, end, divisor ) where it return the sum of all

integers between “start” up to “end” which are divisible by “divisor”. Implement the same

functionality using recursion.

Develop the function reverse( number ) which reverse the digits of a number, so 123

becomes 321. check that it is only positive integer otherwise return None.

Develop the function clock( hours,minutes,seconds ) which return time in seconds only.

Check that the hours,minutes and seconds are within range otherwise return None.

Develop the function decimalToBinary( number ) which return number in binary. Return

None if negative number. Implement the opposite from BinaryToDecimal.

Develop the function averageMinMax() which asks the user if he wants to enter a new

number or not. If the user choose not, then the program prints the average of all the numbers

entered by the user. Also the maximum and minimum number among them. If the user says

yes, then you should read a new number. Keep looping forever until the user enters not.

Make the same function but this time the input comes from a file containing numbers, each

umber on a separate line. (HINT: use the function int() to change from a string to integer).

Develop a function which take a filename and print these information about the text inside:

Count all upper alphabets

Count all lower alphabets

Count all vowels

Count all digits

Count all spaces

Count all commas.

In that text replace every “math” by “the best science ever” without case distinction

Write a function which answer the following questions:

In the English language, what is the most used alphabet and the least used alphabet.

Group the number of words in English language by its length. And tell us which word

length is used the most and which is used the least.

(HINT: this program needs alt of trails! Use the file of the words of the English

language)