PARVATHY-VIJAYAN / fuzzy-couscous

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LAB - 6

Functions

Write a Python program to create a function:

  1. That returns a list of all four-digit numbers that have all their digits even and are perfect squares. (for eg:-, the output should include 6400 but not 8100 (one digit is odd) or 4248 (not a perfect square)

  2. That accept an integer number, find if it is a Disarium number or not (Hint: A number is said to be a Disarium number when the sum of its digit raised to the power of their respective position is equal to the number itself. Eg: 175 is a Disarium number, 11 + 72 + 53 = 175)

  3. That returns a list of all the Disarium numbers between two limits. The function accepts limits as the parameters.

  4. That accepts a string, checks for Palindrome, and returns True or False respectively.

  5. That accepts an arbitrary number of words and returns the count of each word.

  6. That accept two lists and return True if they have at least one common item else return False.

  7. That accepts two numbers and returns the GCD (greatest common divisor) of the numbers.

  8. That accepts an arbitrary number of keyword arguments and returns the maximum value.

  9. That accepts a string and returns a list of all duplicate characters in the string.

  10. That accepts a number, finds the factors, and returns two lists. The first list contains all the odd factors and the second list all the even ones.

Write a Python program to create a recursive function:

  1. That accepts a number and finds the harmonic sum of that number. (Hint: the harmonic sum of n is equal to the sum of reciprocals of positive integers up to n). For example, if n =3, HS = 1+1/2+1/3
  2. That accepts a number and finds the sum of the geometric series of that number. (Hint: Geometric series of 4 = 1+1/2+1/4+1/8)
  3. That accepts two integers and finds the gcd (greatest common divisor) of them.
  4. That accepts a decimal integer and displays its binary equivalent.
  5. To find an item in a sorted list using a binary search

About


Languages

Language:Jupyter Notebook 100.0%