Answered step by step
Verified Expert Solution
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
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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started