Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Python Write a Python program that implements the following options based on the user choice: 1. Find LCM of two numbers. 2. Check Armstrong number.

Python image text in transcribed
image text in transcribed
Write a Python program that implements the following options based on the user choice: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and lower Case Letters in a String. 4. Check Palindrome string. 5. EXIT Implement the method as follows: 1. find_lcm: This method takes two numbers and returns the least common multiple (LCM) of two numbers. 2. armstrong_num: This method takes an n-digit integer and checks whether it is an Armstrong number or not. A positive integer is called an Armstrong number of order n if: abcd... - a'+b+c+d" + ... 3. upper_lower_letters: This method takes a string and returns the number of lowercase letters and uppercase letters in the string. 4. palindrome_str: This method takes a string and checks if it is a palindrome (return True) or not (return false). A palindrome string is a string that reads the same backward as forward. 5. exit: This option will exit the program Sample output: Choose from the menu: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and Lower Case Letters in a String. 4. Check Palindrome string. 5. EXIT. Enter your choice: 1 Enter the first number: 12 Enter the second number: 10 The LCM of 12 and 10 is 60 Choose from the menu: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and lower Case Letters in a String. 4. Check Palindrome string. 5. EXIT. Enter your choice: 2 Enter n digits number: 407 407 is an Armstrong number Choose from the menu: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and lower Case letters in a string. 4. Check Palindrome string. 5. EXIT. Enter your choice: 8 Invalid Choice!!!! Choose from the menu: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and Lower Case Letters in a string. 4. Check Palindrome string. 5. EXIT. Enter your choice: 3 Enter string: Python Code The number of lowercase characters is: 8 The number of uppercase characters is: 2 Choose from the menu: 1. Find LCM of two numbers. 2. Check Armstrong number. 3. Count Upper and lower Case Letters in a String. 4. Check Palindrome string. 5. EXIT. Enter your choice: 4 Enter string: Madam It is a palindrome string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago