Class5-Python-Module-Week3

1-perfect_number.py

Perfect number: Perfect number is a positive integer that is equal to the sum of its proper divisors.

The smallest perfect number is 6, which is the sum of 1, 2, and 3.

Some other perfect numbers are 28(1+2+4+7+14=28), 496 and 8128.

Write a function that finds perfect numbers between 1 and 1000. Check perfect numbers between 1 and 1000 and find the sum of the perfect numbers using reduce and filter functions.

2-reading_number.py

Write a function that outputs the transcription of an input number with two digits.

Example:

28---------------->Twenty Eight

3-alphabetical_order.py

Write a function that takes an input of different words with hyphen (-) in between them and then:

  • sorts the words in alphabetical order,
  • adds hyphen icon (-) between them,
  • gives the output of the sorted words.

Example:

Input  >>> green-red-yellow-black-white
Output >>> black-green-red-white-yellow 

4-unique_list.py

Write a function that filters all the unique(unrepeated) elements of a given list.

Example:

Function call: unique_list([1,2,3,3,3,3,4,5,5])
Output       : [1, 2, 3, 4, 5]

5-equal_reverse.py

Write a function that controls the given inputs whether they are equal to their reversed order or not.

Example:

Input  >>> madam, tacocat, utrecht 
Output >>> True, True, False

Bonus Question 1

HACKERRANK: FIND DIGITS

Bonus Question 2

HACKERRANK: CAPITALIZE