Question: Python program that includes the following logic Task A: Create a function called input_values: Accept two strings from the user. Validate that the string contains

Python program  that includes the following logic

Task A: Create a function called input_values:

Accept two strings from the user.

Validate that the string contains only letters of the alphabet

Validate that both strings are of odd length

Return the strings to main

Task B: Create a function called is_perfect_square:

This function should be called from main, once for each string and the string passed as arguments. (Note you will have two calls to this function)

Find the length of the string

Check if the length is a perfect square. You CANNOT use any math functions like pow() or sqrt() from the Python library.

Return a bool value to main depending on the outcome

Task C: Create a main function:

Call the input_values function and capture the return values

Call the is_perfect_square function two times and pass in each string. Capture the return value

Evaluate the returned bool value and output a descriptive message. Use the f string to format your output.

Example:

Enter first string: abstractednesses

Enter second string: eagerness

The length of 'abstractednesses' is a perfect square

The length of 'eagerness' is a perfect square

(Note: both words in the output message have single quotes surrounding them)

 

How do you check for a perfect square?

A perfect square is an integer that is the squared value of an integer. The square root of the perfect square is an integer that exists between 1 and the number.

For example:

9 is a perfect square.

It is the square of 3.

3 is less than 9.

A loop can be used to find 3.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The required program is as follows The result is as follows Notice that w... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!