Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need full answer of all questions 1,2 Q1. [5 pts] (control structure repetition) Write a Python program that reads a a string containing only

image text in transcribedI need full answer of all questions 1,2

Q1. [5 pts] (control structure repetition) Write a Python program that reads a a string containing only square brackets, [], The program must check whether the brackets are balanced or not. The brackets are said to be balanced if, for every opening bracket, there is a closing bracket. Number of brackets and order (opening and closing) brackets matters. Sample output \#1: Please enter a string: [Hello [How [Are ] You] Today] The string is balanced. Sample output \# 2: Please enter a string: [How [are ]you ] today ] The string is unbalanced. Sample output \# 3: Please enter a string: ]How [are [you ] today The string is unbalanced. Q2. [5 pts] (Methods) ] Write and test a Python function to check whether any positive number is an Armstrong number or not, you have to perform the summation of, three times multiplication of, all the digits present in the number, if the summation result is equal to the actual number then the number will be an Armstrong number, otherwise the number will not be an Armstrong number, following is the example: Since 153=111+555+333. So 153 is an Armstrong number Since 12 is not equal to 111+222. So 12 is not an Armstrong

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

To become aware of strategies for using time more effectively

Answered: 1 week ago

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago