View the step-by-step solution to:

Problem : Write a function that given a list of numbers , returns True if and only if all of the numbers in the list form an arithmetic progression ,...

problem1.pngproblem.png

What is the answer in these 2 problems? I thought for hours, I really can't think of an answer. I was going to use n, n+1 or n-1 to compare and find the answer, but I don't know how to write the code.

problem.png

Problem : Write a function that given a list of numbers , returns True if and only if all of the
numbers in the list form an arithmetic progression , that is the difference between any two
Successive numbers in the list is the same . Your main program should allow the user to enter
SPACE - Separated numbers as test lists , until a blank line is entered .
List : 1 2 3
True
List : 1 3 4
False
List : 3 2 1 0
ITUE
List : I
True
List : IT
TRUE
List : 10 9 8 7 4 3 2 1
False
List :

problem1.png

Problem : Write a function that given a list of numbers , returns the length of the longest
sequence of numbers within that list that forms an arithmetic progression . Your mail Program
should allow the user to enter space - separated numbers as test lists , until a blank line is centered .
List : 1 2 3
3
List : 1 3 4
2
List : 3 2 1 0
4
List : I
1
List : IT
2
List : 10 9 8 7 4 3 2 1
4
List :`

Top Answer

View the full answer
output.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online