Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 3.7 please help Question 1 (25 points) Define vector 7 = [3.2, 6, 7.8, 1. 3. 2.5, 100). 1. Write a lo op that

python 3.7 please help
image text in transcribed
Question 1 (25 points) Define vector 7 = [3.2, 6, 7.8, 1. 3. 2.5, 100). 1. Write a lo op that adds the number 5 to all values of this vector that are smaller than 4. Do not just add this by hand, I need to see whether you can write a loop. You probably want to use an if statement as well. The resulting vector should look like this 7 = 18.2, 6, 7.8, 6, 8, 7.5, 100). 2. Use the original vector and write a loop that replaces all values between 2 and 5 (including 2 and 5) with -1 so that you get 7 = (-1, 6, 7.8, 1. - 1. - 1. 100). 3. Use the original vector and extract the last 3 values using vector slicing and print them on the screen no loop) 4. Use the original vector and extract the 2nd to 5th element i.e., 6, 7.8, 1, 3) using slicing from the vector and print the result on the screen (no loop)

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago