Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do the best you can to put this into python. I provided some of the syntax guide i thought would be most helpful for

image text in transcribed
image text in transcribed
image text in transcribedplease do the best you can to put this into python. I provided some of the syntax guide i thought would be most helpful for the assignment
The Perrin numbers are the defined by the linear recurrence equation: P(n) = P(n 2) + P(n 3) Where the following initial conditions are given: P(0) = 3, P(1) = 0, P(2) = 2 Calculate terms P(3) through P(5) by hand using the recurrence equation and initial conditions given above. Use these as test values for your Python program. Write a Python program that calculates Perrin numbers to the nth term. The program should: Prompt the user for a positive integer value 'n'. Check if the value entered by the user is positive. If not continue to prompt user for a positive integer value. Compute the Perrin sequence to the nth term using the recurrence equation and initial conditions given above. Save the terms in a list. Output the Perrin sequence for the number of terms entered by the user to the IDLE Shell. Input Statements: * Prompt for Decimal Number X - float (input ('Enter the value for variable, % ')) + Prompt for Integer y - int (input ('Enter the integer value for variable, y ')) I Prompt for String month- input ('Enter the month you were born ') I Prompt for List of Numorical Values List eval (input ('Enter list values in square brackets separated by commas ')) Output Statements: Decimal Numbers * = 75.176 print ('The variable x = (0:.2f) '.format(x)} The variable x 75.18 * Integers y = 750 print ('The value of y is: (0) '.format (y)) The value of y is: 750 * Strings course 'Calculus II' print ('The name of this course is: (0) '.format (course)) The name of this course is: Calculus II #Mixture print ('x (0:0.1f), y- (1), course is: (2) '. format (x, y, course)) x - 75.2, y - 750, course is Calculus II Creating 1-d Lists and 2-d Lists: = [2, 7, 6, 42, 73] List ld List 2d = [[1, 5, 7], [2, 4, 6], [10, 14, 18]] Suppose L1 is a l-d List of numbers with at least 5 values L1 [0] # 1st entry in the list, L1 L1[3] # 4th entry in the list, L1 # Pulls out 2nd 3rd, and 4th entries from List, L1 L1 [1:4] # Replaces the 3rd entry of list, L1, with a 5 L1[2] %3D # N = the number of entries in list, L1 N = len (L1) # Puts a 12 at the end of the list, L1 L1.append (12) # Deletes 2nd entry in the list, L1 del L1[1] Suppose L2 is a 2-d List of numbers with 5 rows and 3 columns # Entry in row 2, column 3 of list, L2 L2 [1] [2]

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

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions