Question: # ! / usr / bin / env python # coding: utf - 8 # In [ ] : import math invalid = True #The
#usrbinenv python
# coding: utf
# In:
import math
invalidTrue
#The 'displaybanner function prints a header to provide a visual indication that the program has started.
def displaybanner:
print
print SQUARE NUMBER FINDER
print
#The getvalidnumberprompt lowerbound, upperbound function is responsible for
#getting user input and ensuring it meets the specified criteria.
def getvalidnumberprompt lowerbound, upperbound:
while invalid:
try:
value intinputprompt
if lowerbound value upperbound:
return value
invalidTrue
else:
printfInvalid input: Please enter a number between lowerbound and upperbound
invalidFalse
except ValueError:
printInvalid input: Please enter a whole number."
#The 'findsquarenumberslowerlimit upperlimit function computes all the square
#numbers within the provided range.
#starts from the smallest integer whose square is greater than or equal to 'lowerlimit and
#goes up to the largest integer whose square is less than or equal to 'upperlimit
#For each integer i in this range, it calculates i and appends a tuple squarenumber, i
#to the 'squarenumbers' list.
def findsquarenumberslowerlimit upperlimit:
squarenumbers
for i in rangemathceilmathsqrtlowerlimit math.floormathsqrtupperlimit:
squarenumber i
if lowerlimit squarenumber upperlimit:
squarenumbers.appendsquarenumber, i
return squarenumbers
#The 'displaysquarenumberssquarenumbers function prints each square number along with its square root.
def displaysquarenumberssquarenumbers:
printfSquare Numbers Between lowerlimit and upperlimit
for number, root in squarenumbers:
printfnumberroot squared
displaybanner
lowerlimit getvalidnumberPlease enter the lower bound:
upperlimit getvalidnumberPlease enter the upper bound: lowerlimit
squarenumbers findsquarenumberslowerlimit upperlimit
displaysquarenumberssquarenumbers
inputPress Enter to close the program..."
# In:
PLEASE DONT USE INFINTE LOOP, AS IN WHILE TRUE.
Can you please make this code more human?
Please also provide plan for the code.
Please also provide Pseoudocode. as in expected output, actual output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
