1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anna11 [10]
2 years ago
14

Create an array w with values 0, 0.1, 0.2, . . . , 3. Write out w[:], w[:-2], w[::5], w[2:-2:6]. Convince yourself in each case

that you understand which elements of the array that are printed.
Computers and Technology
1 answer:
larisa86 [58]2 years ago
6 0

Answer:

w = [i/10.0 for i in range(0,31,1)]

w[:]  = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0]

w[:-2] = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8]

w[::5]= [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]

w[2:-2:6] = [0.2, 0.8, 1.4, 2.0, 2.6]

Explanation:

List slicing (as it is called in python programming language ) is the creation of list by defining  start, stop, and step parameters.

w = [i/10.0 for i in range(0,31,1)]

The line of code above create the list w with values 0, 0.1, 0.2, . . . , 3.

w[:]  = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0]

since start, stop, and step parameters are not defined, the output returns all the list elements.

w[:-2] = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8]

w[:-2] since  stop is -2, the output returns all the list elements from the beginning to just before the second to the last element.

w[::5]= [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]

w[::5] since  step is -2, the output returns  the list elements at index 0, 5, 10, 15, 20, 25,30

w[2:-2:6] = [0.2, 0.8, 1.4, 2.0, 2.6]

the output returns the list elements from the element at index 2  to just before the second to the last element, using step size of 6.

You might be interested in
What software can be used for remote operation of a sunsdr2 dx?.
Rasek [7]

Answer:

Install the ExpertSDR2 Remote Client software on your PC. Download the client here. You can also access your device via any web browser

8 0
2 years ago
6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late s
Brums [2.3K]

Answer:

Compare the predictions in terms of the predictors that were used, the magnitude of the difference between the two predictions, and the advantages and disadvantages of the two methods.

Our predictions for the two models were very simmilar. A difference of $32.78 (less than 1% of the total price of the car) is statistically insignificant in this case. Our binned model returned a whole number while the full model returned a more “accurate” price, but ultimately it is a wash. Both models had comparable accuracy, but the full regression seemed to be better trained. If we wanted to use the binned model I would suggest creating smaller bin ranges to prevent underfitting the model. However, when considering the the overall accuracy range and the car sale market both models would be

Explanation:

8 0
3 years ago
What is metrical task system algorithm?? and can we use that in online shopping project??
jeyben [28]

Answer:

Metrical task system algorithm is the online algorithm that is used for organizing the online problems like k-server issues, paging issues etc.This task system works in the form of metrics to decrease the complete cost  experienced due to processing of the operation and analyzing the competition.

It can be used for the online shopping project for the analyzing the comparison between the performance on basis of online and offline trends and then optimization can take place according to the the results.

7 0
3 years ago
The second stage of digestion takes place in the small intestine. <br> True Or False?
DedPeter [7]
False. The second stage of digestion happens in the stomach.
8 0
3 years ago
Why is linux referred to as open source software?
ss7ja [257]
<span> </span>Linux<span> is a computer operating system, like Microsoft Windows or Apple Mac OS they call it Free </span>Software/Open Source<span>, or Socially Responsible </span>Software<span>. Closely related is the concept of </span>Open Source Software<span>.</span>
7 0
3 years ago
Other questions:
  • Systematically tackling the threats and vulnerabilities in the seven individual domains of a typical IT infrastructure helps you
    6·1 answer
  • What is intellectual property?
    13·1 answer
  • Imported data that maintains a refreshable link to its external source is called ____ data.
    7·1 answer
  • __________ can be used to replace internal network addresses with one or more different addresses so the traffic that actually t
    9·1 answer
  • This program will convert a set of temperatures from Fahrenheit to Celsius and Kelvin. Your program will be reading in three dou
    11·1 answer
  • When you connect a device to your computer for the first time, Windows Media Player selects the ____ method that works best for
    15·2 answers
  • You have two microservices that need to communicate with each other without holding up a thread on either end. One service will
    6·1 answer
  • Complete the AscendingAndDescending application so that it asks a user to enter three integers. Display them in ascending and de
    7·1 answer
  • If I am working in a document and wish to follow a hyperlink, what should I do?
    7·1 answer
  • The ratio of boys and girls is 4:5 calculate the number of boys if the are 1080 learners in schools​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!