Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (Total 20 marks) List and NumPy Array You are required to write codes to perform the following tasks using Python list structure and

image text in transcribed

1. (Total 20 marks) List and NumPy Array You are required to write codes to perform the following tasks using Python list structure and NumPy Array structure. Fill in the table provided in the Answer Book. (a) (6 marks) Create a Python list and a NumPy Array, named my_list and my_nparray respectively, with numbers -1 to -10. Instead of hardcoding the numbers, you are required to use the function range() for the Python list and arange() for the NumPy Array to create the data structure. (b) (2 marks) Find the number of items in the Python list and the NumPy Array created in (a). (c) (2 marks) Output the item at index 0 of the Python list and the NumPy Array created in (a). (d) (2 marks) Using slicing and negative indexing, output the last 3 items in the Python list and the NumPy Array created in (a). (e) (2 marks) Change the third element in the Python list and the NumPy Array to the last digit of your student ID. (f) (4 marks) Convert all the elements in the Python list and the NumPy Array to their absolute values. (g) (2 marks) Append the number 99 to the end of Python list and the NumPy Array resulted in (f).

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions