Question
Python 3 Implement a function constantDiff() that takes a list of characters and an integer as parameters. The function returns True if the difference between
Python 3
Implement a function constantDiff() that takes a list of characters and an integer as parameters. The function returns True if the difference between the encoding of each adjacent pair of characters in the list produces a value equal to the second parameter. If there is any pair of adjacent characters in the list whose encodings do not produce the second parameters as the result when they are subtracted (ignoring the sign), the function should return False. If the function is given a list with one element, an empty list, or a negative value for the difference, the function should return False. Hint: Use an indexed loop (e.g. one that directly manipulates indices using the range() function). The following shows what the function would return for several sample executions:
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