Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON PROGRAMMING QUESTION 4 Functions and Lists (Sequences) Here is the definition of a sequence: The first, second, and third terms are 1. The nth

PYTHON PROGRAMMING

image text in transcribed

QUESTION 4 Functions and Lists (Sequences) Here is the definition of a sequence: The first, second, and third terms are 1. The nth term is the (n-1)th + (n-2)th term + (n-3)th term. So the 4th term is the sum of the 1st, 2nd, and 3rd terms, and the 5th term is the sum of 2nd, 3rd, and 4th terms etc. Thus the sequence looks like this: 1, 1, 1, 3, 5, 9, 17, 31,..... Write a function call sequence(n) that takes in an integer n and returns a list containing all of the terms in this sequence from 1 up to the nth term. 1 You will need to also write a short program to call and test this function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions