The dot product of two vectors a = [a, ,..., an] and b=[b,b2,...,bn can be defined...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The dot product of two vectors a = [a₁, ª₂,..., an] and b=[b₁,b2,...,bn can be defined algebraically as a∙b=a₁b₁+a₂b2+...+anbn Given the following two vectors represented using Python lists: vector1 = [1,-5, 6, 11, −13, 17] vector2 = [-10, 8, 14, -7, -3, 19] Write a program that calculates and prints the dot product of these two vectors. Notes: • The output must be in the format shown in the example, including the format of the prompt, and all spaces and punctuation. • Your solution must use a while loop. • You may assume both vectors are the same length. For example: Test #Execute program The dot product of [1, -5, 6, 11, -13, 17] and [-10, 8, 14, -7, -3, 19] is 319. Result Complete the following program which prompts the user to enter their first name and then their surname. The program will generate a 5 letter username consisting of the first letter of the user's first name and the first 4 letters of the user's surname. If the user's surname is less than 4 letters in length, the program will add the required number of "*" characters to the end of the username to ensure it has a length of 5. Notes: • The output must be in the format shown in the example, including the format of the prompt, and all spaces and punctuation. For example: Input Result Damir Please enter your first name: Damir Azhar Please enter your surname: Azhar Your username is: DAzha John Please enter your first name: John Doe Please enter your surname: Doe Your username is: JDoe* The dot product of two vectors a = [a₁, ª₂,..., an] and b=[b₁,b2,...,bn can be defined algebraically as a∙b=a₁b₁+a₂b2+...+anbn Given the following two vectors represented using Python lists: vector1 = [1,-5, 6, 11, −13, 17] vector2 = [-10, 8, 14, -7, -3, 19] Write a program that calculates and prints the dot product of these two vectors. Notes: • The output must be in the format shown in the example, including the format of the prompt, and all spaces and punctuation. • Your solution must use a while loop. • You may assume both vectors are the same length. For example: Test #Execute program The dot product of [1, -5, 6, 11, -13, 17] and [-10, 8, 14, -7, -3, 19] is 319. Result Complete the following program which prompts the user to enter their first name and then their surname. The program will generate a 5 letter username consisting of the first letter of the user's first name and the first 4 letters of the user's surname. If the user's surname is less than 4 letters in length, the program will add the required number of "*" characters to the end of the username to ensure it has a length of 5. Notes: • The output must be in the format shown in the example, including the format of the prompt, and all spaces and punctuation. For example: Input Result Damir Please enter your first name: Damir Azhar Please enter your surname: Azhar Your username is: DAzha John Please enter your first name: John Doe Please enter your surname: Doe Your username is: JDoe*
Expert Answer:
Related Book For
Computer Organization And Design The Hardware Software Interface
ISBN: 9780123747501
4th Revised Edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Write a program for SMP to compute the dot product of two vectors of size 1000. Assume we have 10 processors. Show all the details.
-
The following data represent the concentration of dissolved organic carbon (mg/L) collected from 20 samples of organic soil. Assume that the population is normally distributed. Complete parts (a)...
-
The average intensity of a particular TV stations signal is 1.0 x 10-13 W/m2 when it arrives at a 33-cm-diameter satellite TV antenna. (a) Calculate the total energy received by the antenna during...
-
In the previous problem, what would the ROE on the investment have to be if we wanted the price after the offering to be $73 per share? (Assume the PE ratio remains constant.) What is the NPV of this...
-
In the benzene adsorber of Example 9.7, the flow rate is increased to \(0.25 \mathrm{~m}^{3} / \mathrm{s}\). Calculate the breakthrough time and the fraction of the bed adsorption capacity that has...
-
The equity sections from Atticus Groups 2013 and 2014 year- end balance sheets follow. Stockholders Equity (December 31, 2013) Common stock $ 4 par value, 100,000 shares authorized, 40,000 shares...
-
Develop an algorithm, in the form of a Raptor flowchart, to compute and display the amount of federal income tax to be paid when provided with the income as input. The Canadian Federal income tax...
-
Slopes Inc. manufactures and sells snowboards. Slopes manufactures a single model, the Pipex. In the summer of 2015, Slopes's accountant gathered the following data to prepare budgets for 2016. These...
-
Find the solution of the following Differential Equations 1) y' = ky 3) y'-2y+a = 0 5) (xIn x)y' = y 7) y' = 2xy-1 9) 2y' = y cot(x) 11) y' = (1+x)(1+ y) 13) y' = y tanh(x) 15) y' = y tan(2.x), y(0)...
-
Many procurement professionals are wary of pre-award communication and interaction with potential suppliers, considering it to be "dangerous." Why is this the case? -Public Administration
-
Imagine you are the US Ambassador to a country of your choice. A US ambassador officially represents the US government on behalf of the president, maintains diplomatic relations, and helps to promote...
-
1. What are the market definition and market power of Intel? 2. Discuss the Intel's conditional rebate program. How did it disadvantage competitors? 3. Intel sells CPU at $5 with cost at $3. If a...
-
Find the root of the coupled equations x+2cosx+y-1=0 2x-siny-8=0 by the Newton-Ralphson method. (a) Put the iteration formula in the matrix form Az = b, Ar where "i" is the iteration index, and Z= so...
-
The gravity equation states that countries with higher GDP, or that are close, will trade more. In addition, research has shown that there is more trade within countries than between countries....
-
Kaitlin is the sales manager at a lumber supply company, so successful in its geographic region that it employs 250 full-time workers, and 50 part-time. In addition to selling lumber to builders, the...
-
Find a least expensive route, in monthly lease charges, between the pairs of computer centers in Exercise 11 using the lease charges given in Figure 2. a) Boston and Los Angeles b) New York and San...
-
Find the word or phrase from the list below that best matches the description in the following questions. Use the numbers to the left of words in the answer. Each answer should be used only once....
-
The following table shows results for SPEC CPU2006 benchmark programs running on an AMD Barcelona. Find the CPI if the clock cycle time is 0.333 ns. a. b. Name Intr. Count x 10 Execution Time...
-
What is the accuracy of your predictor from 4.24.4 if it is given a repeating pattern that is the exact opposite of this one? Exercise 4.24.4 Design a predictor that would achieve a perfect accuracy...
-
Do you believe that fraud in the United States is more or less prevalent than fraud in countries outside the United States? Why?
-
How would a fraudster conceal missing cash, especially amounts of this magnitude?
-
Why is it difficult to convict organized crime leaders?
Study smarter with the SolutionInn App