Simple python programs to practice:
1) Write a Python function Factorial(n) which returns the factorial of the given number(n).
2) Write a Python function, Square(num) which returns the square of the given number(num).
3) Write a Python function, Sum(n) which returns the sum of first n numbers.
4) Write a Python function, Palindrome(num) that accepts an integer num as input and returns true/false based on condition.
Ex: num = 12321 ---> output = 12321 ----> then given number is palindrome.
5) Write a Python function, check_strong_number(num) that accepts a positive as input, and returns true/false based on condition.
1) Write a Python function Factorial(n) which returns the factorial of the given number(n).
2) Write a Python function, Square(num) which returns the square of the given number(num).
3) Write a Python function, Sum(n) which returns the sum of first n numbers.
4) Write a Python function, Palindrome(num) that accepts an integer num as input and returns true/false based on condition.
Ex: num = 12321 ---> output = 12321 ----> then given number is palindrome.
5) Write a Python function, check_strong_number(num) that accepts a positive as input, and returns true/false based on condition.
- A number is said to be a Strong number if the sum of the factorial of each digit is equal to the given number.
No comments:
Post a Comment