Python program that includes the following logic Task A: Create a function called input_values: Accept two strings
Fantastic news! We've Found the answer you've been seeking!
Question:
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.
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
Posted Date: