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
-
Simplify. 12-5v-14 2 2v-8
-
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 condensed statement of financial position of Laporte Corporation reports the following amounts: The common shares are currently trading for $30 per share. Laporte wants to assess the impact of...
-
The following graph shows the marginal and average product curves for labor, the firm's only variable input. The monthly wage for labor is $2,000. Fixed cost is $120,000 a.At what output does the...
-
The average Costco warehouse in the United States generates an average of \($127,000,000\) of net sales. When opening a new warehouse, Costco managers will measure the warehouse's success by how...
-
Data Set 16 in Appendix B lists 50 magnitudes (Richter scale) of 50 earthquakes, and those earthquakes have magnitudes with a mean of 1.184 with a standard deviation of 0.587. The strongest of those...
-
How has your analysis of Define and Measure informed your ability to analyze? In what ways do you feel you need additional information to analyze appropriately? What is essential about clarity of...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Sonja didn t give Paul all of the information he needed to complete his report, knowing that this would cause him to look bad at tomorrow s meeting. Sonja Paul.
-
1.Give one reason why an investor may decide to exercise an in-the-money call option rather than sell it.
-
You are considering an investment that will pay $22845 in 14 years. If the interest rate is 10.99%, what is the most you should be willing to invest today?
-
Mind Tree Ltd . belongs to an industry in which equity shares sell at par on the basis of 1 0 per cent dividend yield provided the net tangible assets of the company are 2 4 0 per cent of the paid up...
-
Problem 3 : Controllability Gramian (a) Consider the following state equation: -0.5 0 x = - [ 85 9] = + [8]. x U 0 x(0) = [0:1] (i) (2 points) Show that there exists an input u(t) that drives x(0) to...
-
If you have $577 today and you think you can earn an interest rate of 6% per year, how many years until you have $982?
-
For the function g(x)=x^(2)-4x+2, can one apply the Intermediate Value Theorem on the interval -2,2 to find a zero in that interval?
-
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...
-
Sole traders, partnerships and limited companies all have different users who need financial information for different purposes. Discuss.
-
What is fi nancial accounting and why is its study important?
-
Formal defi nitions The objective of general purpose fi nancial reporting is to provide fi nancial information about the reporting entity that is useful to existing and potential investors, lenders...
Study smarter with the SolutionInn App