Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Homework ISE 4120: Quality and Reliability Engineering Homework 2 (Due Thursday 1/30/2020 at the beginning of the class) This assignment should be submitted online

image text in transcribed
image text in transcribed
image text in transcribed
Python Homework
ISE 4120: Quality and Reliability Engineering Homework 2 (Due Thursday 1/30/2020 at the beginning of the class) This assignment should be submitted online in Carmen. Submit one .zip file containing a report (a .pdf file) and your python codes for all problems as one .py file. The python code should be sep- arated into different cells (using "#%%" command) for different problems and have a label for each problem. In your report include your python code for each problem along with the output in the order of the problems (no appendix), and a brief description of the results. Failure to follow this instruction will result in a penalty. Problem 1. (10 pts) Sum the integers from 1 to 20 and return the results at each iteration Hint: use for loop and print(). Problem 2. (10 pts) Generate your own two lists of integers and create a third list such that it only contains odd numbers from the first list and even numbers from the second list, and print the result. Hint: From numpy.random use the function randint and then convert the resulting array to a list using list() command. Finally, use for loop, if and print() Problem 3. (10 pts) Generate your own two lists of your choice and create a third list such that it contains odd-indexed elements from the first list and even-indexed elements from the second list and print the result. Hint: Note that in Python indexing starts at 0. Take the 0 index as an odd index. To subset a list, e.g. 9, over its even elements use q start index: ending index: step). Problem 4. (10 pts) Generate your own list of numbers from 1 to 10 with 3 replicates. Then, write a code that takes this list and removes duplicated numbers. Finally, find the maximum and minimum of the list. Problem 5. (10 pts) Choose your own a and b, then plot the functions y=r? + ax + b y = ar + b y=a3 + b in one figure with the same range for I. Make sure that they have different colors, line styles and markers so that they can be distinguished. Set line width to be 3, add legends, title and labels for x and y axes. Hint: use matplotlib.pyplot package. Problem 6. (15 pts) Consider the following matrices and vector: [10 25 1 8 15] [2 6 23 4 7] 20 5 7 14 16 14 15 9 15 23 A= 4 6 13 20 22 , B = 12 14 21 29 8 .3= 10 12 19 21 3 23 20 20 11 16 (11 18 25 2 9 ] 24 22 5 18 21 Use numpy package to calculate (a) A+B (b) AB (c) AT (d) A- (e) A (f) rank(A), rank(B) Problem 7. (10 pts) Use numpy package to solve a system of linear equa- tions: 3r, +212 +673 = 26 211 - 312 + 5x3 = 18 501 + 12 + 4x3 = 11 Problem 8. (15 pts) Using pandas package and the dataset available at https://github.com/mwaskom/seaborn-data/blob/master/iris.csv, do (a) Import the dataset and print the first and last three rows. (b) Print all "virginica species details. (c) Count total samples per species. (d) Find each species' largest 'sepal.width". (e) For each species, find the average number of all four features (f) Visualize the distribution of petal length of 'setosa' by plotting a his- togram. Hint: Using functions in pandas, (a) - (e) should be done with a few lines of code. No loop or if is needed. To plot histogram, use pyplot.hist(). Problem 9. (10 pts) Fill in the missing data in bike.csv available at https: //github.com/samdavanloo/ISE-4120/blob/master/DataFiles/bike.csv. The detail of this dataset is available at https://archive.ics.uci.edu/ml/ ts/bike+sharing+dataset. Use all methods discussed in the class

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_2

Step: 3

blur-text-image_3

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

Question

Solve the following 1,4 3 2TT 5x- 1+ (15 x) dx 5X

Answered: 1 week ago