x = [1, 3, 2, 5, 7]
Starting from the first value of a list:
if the next value is greater, it prints "\nthe value x is greater than y"
if the next value is equal, it prints "\nthe value x is equal to y"
if the next value is smaller, it prints "\nthe value x is smaller than y"
How do I translate this into the exact Python code? I'm actually working with a pandas data frame, I just simplified it by using a list as an example.
x = [1, 3, 2, 5, 7]
With the given above, the output should be like this:
the value 3 is greater than 1
the value 2 is smaller than 3
the value 5 is greater than 2
the value 7 is greater than 5