Homework 1 DS 440 Data Mining Maximum points: 100 Due: September 28 (Wednesday), 11:59pm Question 1: (20 points) Fibonacci sequence (Fn), is defined as a sequence of numbers such that each number is...

Added the file


Homework 1 DS 440 Data Mining Maximum points: 100 Due: September 28 (Wednesday), 11:59pm Question 1: (20 points) Fibonacci sequence (Fn), is defined as a sequence of numbers such that each number is the sum of two preceding ones starting from 0 and 1 (F0 = 0 and F1 = 1). Hence, we have the following value at n th position Fn = Fn−1 + Fn−2 Write a python function that takes the number of elements the user wants in the generated Fibonacci sequence as a parameter. The function should return the generated Fibonacci sequence when called. Hence, • For user input n = 0, function should return [ ] • For user input n = 1, function should return [0] • For user input n = 2, function should return [0, 1] • For user input n = 3, function should return [0, 1, 1] .. and so on Question 2: (20 points) Write a function in python that takes a list of numbers from the user and returns a different list which only contains those numbers from the original list that are within the range [µ − σ, µ + σ]. Here µ and σ are the mean and standard deviation of numbers in the original list. Question 3: (30 points) Write a function in python that takes a list (or an 1 dimension array) from the user as a parameter and 1. (10 points) Inserts a 0 at the second last position. For example if list was [0,1,2,3], then the modified list would be [0,1,2,0,3] 1 2. (10 points) Then checks for all the duplicates in the list and removes them. For example if the list was [0,1,2,0,3], then after removal it will become [0,1,2,3], i.e. always keeps the first instance of the number to be removed. 3. (10 points) Then finds the location of the 3rd smallest number in the list. For example if the list was [0,1,2,3], the location would be 2. The function should return the final modified list and the location found in part 3. Question 4: (30 points) Write a python function that takes an integer (n) as an input and: 1. (10 points) If the integer is less than 1, the function should print an error message and return nothing. 2. for other cases: (a) (10 points) Returns a numpy array with a checkerboard pattern. For example if user provides n = 5 to the function, then it should return the 5x5 array  0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0  (b) (10 points) Plots the checkboard pattern as an image with grayscale colormap. 2
Sep 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here