Please include code where asked to write code and code's output screenshot. 1- Say you want...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Please include code where asked to write code and code's output screenshot. 1- Say you want to write python code that calculates x modulo y wherex and y are two integer variables. Then it assigns the value of y to x and the modulo result to y. It also prints the values of x and y. A python code segment (one line) with a missing line is given below. Write that missing line. x = 200 y = 100 # Missing line print(fx: {x}.y:{y}') 2- You are given with a string variable x="Hello World". Write a python code segment that prints "eoo" 3- Consider the following python code to print integer number from 0 to 10. for j in range(0,10) print(j) This code has some issues, mention those issues. 4- Write a python code that takes an integer from a keyboard (denoted by variable x). If the number is less than 99 and even, your program calculates its factorial (x!) and prints the factorial value in your screen. If the number is less than 99 and is odd, your program prints. "this is an odd number". If the number is greater than 99, it prints "the number is too big". 5- Consider you have the set of data comprising the heights (in meters) ofa group of people and their corresponding weights (in kg) given in Table 1. Table 1: Height and actual weight. Height [m] 1.6 1.65 1.7 1.73 1.8 Weight [Kgs] 60 65 72.3 75 80 a. Using python, plot a chart/graph height vs weight. x-axis should be "height in m" and y-axis should be "Weights in Kgs. b. From your plotted chart/graph. do you see any correlation between the weights and the heights for this group of people? If yes, mention what kind of correlation you observe. c. Now say you want to use the data in the table and predict the weight of another person based on his/her height that is given to you. In order to do so. one option is that you draw 6-a straight line through the points in your plotted graph and use that line to predict the weight of another person given his/her height. This is called linear regression which is a linear approach for modelling the relationship between a scalar dependent variable of Y ("weight" in this case) and one or more explanatory variables (or independent variables, X) which is "height" in this case. In order to draw a straight line, you can use the equation: Y = ax + b. Assuming values for a = 103 and b = -104, using Python plot a straight line in the same chart/graph height vs weight that you plotted for Question a. d. Using Y = ax + b where a = 103 and b = -104. predict weights (Y) corresponding to following heights (X) and fill in column 2 of Table 2 given below. Table 2: Height vs predicted weights Predicted Weights [Kgs] Height [m] 1.6 1.65 1.7 1.73 1.8. 1.76 (this height is not given on table 1) e. Do you observe any error i.e.. the difference between actual weight in Table 1 and predicted weight in Table 2 for given heights in Table 1? Write down errors for each height given in Table 1. If you use another set of values of a and b, what is your opinion about the errors? Will they be changed or not? If like, you can check by repeating Questions d) and e) with another set of values of a and b. Please include code where asked to write code and code's output screenshot. 1- Say you want to write python code that calculates x modulo y wherex and y are two integer variables. Then it assigns the value of y to x and the modulo result to y. It also prints the values of x and y. A python code segment (one line) with a missing line is given below. Write that missing line. x = 200 y = 100 # Missing line print(fx: {x}.y:{y}') 2- You are given with a string variable x="Hello World". Write a python code segment that prints "eoo" 3- Consider the following python code to print integer number from 0 to 10. for j in range(0,10) print(j) This code has some issues, mention those issues. 4- Write a python code that takes an integer from a keyboard (denoted by variable x). If the number is less than 99 and even, your program calculates its factorial (x!) and prints the factorial value in your screen. If the number is less than 99 and is odd, your program prints. "this is an odd number". If the number is greater than 99, it prints "the number is too big". 5- Consider you have the set of data comprising the heights (in meters) ofa group of people and their corresponding weights (in kg) given in Table 1. Table 1: Height and actual weight. Height [m] 1.6 1.65 1.7 1.73 1.8 Weight [Kgs] 60 65 72.3 75 80 a. Using python, plot a chart/graph height vs weight. x-axis should be "height in m" and y-axis should be "Weights in Kgs. b. From your plotted chart/graph. do you see any correlation between the weights and the heights for this group of people? If yes, mention what kind of correlation you observe. c. Now say you want to use the data in the table and predict the weight of another person based on his/her height that is given to you. In order to do so. one option is that you draw 6-a straight line through the points in your plotted graph and use that line to predict the weight of another person given his/her height. This is called linear regression which is a linear approach for modelling the relationship between a scalar dependent variable of Y ("weight" in this case) and one or more explanatory variables (or independent variables, X) which is "height" in this case. In order to draw a straight line, you can use the equation: Y = ax + b. Assuming values for a = 103 and b = -104, using Python plot a straight line in the same chart/graph height vs weight that you plotted for Question a. d. Using Y = ax + b where a = 103 and b = -104. predict weights (Y) corresponding to following heights (X) and fill in column 2 of Table 2 given below. Table 2: Height vs predicted weights Predicted Weights [Kgs] Height [m] 1.6 1.65 1.7 1.73 1.8. 1.76 (this height is not given on table 1) e. Do you observe any error i.e.. the difference between actual weight in Table 1 and predicted weight in Table 2 for given heights in Table 1? Write down errors for each height given in Table 1. If you use another set of values of a and b, what is your opinion about the errors? Will they be changed or not? If like, you can check by repeating Questions d) and e) with another set of values of a and b.
Expert Answer:
Related Book For
Ethics in Accounting A Decision Making Approach
ISBN: 978-1118928332
1st edition
Authors: Gordon Klein
Posted Date:
Students also viewed these general management questions
-
You are asked to write policies and procedures for managing the receiving area. Identify the topic areas that you would include:
-
Write a program to print Hello World 25 times without writing a single line in the main function except system(pause).
-
You are given two discrete random variables X, Y that assume the possible values 0, 1 according to the following joint distribution: (a) What are the marginal distributions of X and Y? (b) Are X and...
-
Austin and Anya Gould are a middle-aged couple with two childrenRusty, age 13, and Sam, age 11whom they adopted this year. They also bought a new home in the area to give the children a yard in which...
-
Draw a production function that exhibits diminishing marginal product of labor. Draw the associated total-cost curve. (In both cases, be sure to label the axes.) Explain the shapes of the two curves...
-
Solve each system of equations. If the system has no solution, say that it is inconsistent. 2 + - 32 2 + 2y + z%3D -7 4y 3 %3D 7
-
House Handy Products manufactures plastic products and utensils for use in several situations. The company produces and sells a vast range of products that can be used in the home (plastic cooking...
-
Bovine Company, a wholesale distributor of umbrellas, has been experiencing losses for some time, as shown by its most recent monthly contribution format income statement: Sales . . . . . . . . . . ....
-
temperature change in Metals metal specific heat initial temperature final temperature lead 0.13 aluminum 0.90 Iron 0.45 85C 85C 85C 37C 41C ???????? Three metal blocks of equal mass are placed in...
-
Cheadle Company purchased a fleet of 20 delivery trucks for $8,000 each on January 2, 2019. It decided to use composite depreciation on a straight-line basis and calculated the depreciation from the...
-
4 An increase in the world relative demand for U.S. output causes A) a short-run real depreciation of the dollar against the euro. E) a long-run real appreciation of the euro against the dollar. D)...
-
XY Ltd provides for depreciation of its machinery at 20 per cent per annum on cost; it charges for a full year in the year of purchase but no provision is made in the year of sale/disposal. Financial...
-
You are required to prepare a sales ledger control account from the following information for the month of November: 2010 Nov 1 Sales ledger balances Totals for November: Sales day book Returns...
-
If any fi rms price of labor and capital each double, what will happen to the expansion path (i.e., locus of tangencies between the isoquants and isocost curves)? What will happen to the fi rms...
-
Suppose that you used regression methods to estimate the demand curve for physician visits and found a positive relationship: that is, you found that the higher the price is, the more visits are...
-
Thomas Brown and Partners, a business of practising accountants, have several clients who are retail distributors of the Allgush Paint Spray guns. The current price list of Gushing Sprayers Limited,...
-
You have been approached by a developer with South Carolina solar project. Your manager wants to understand how attractive S.C. market could be or not the particular opportunity is feasible and meets...
-
7. Baladna wants to analyze process that includes delivery by suppliers, production inside the company, transportation to to its customers and information systems. Then it also wants to find out...
-
Varda operates a financial advisory firm that gives advice to small business owners. Varda prepared a loan amortization schedule that assisted Gupta in winning a court judgment against Nguyen for...
-
Your former accounting professor recently contacted you because she knows that you currently work for an accounting firm that performs compilation services for several privately held mining...
-
When an auditor performed an inventory count at a privately-owned medical supply company, it observed that some of the waste from radioactive isotopes produced at that facility three years appeared...
-
Your firms bank has offered you two options for short-term financing in the amount of \($400,000.\) The first option is a committed line of credit with a commitment fee of 0.5% (EAR) and an interest...
-
The Row Cannery wants to borrow \($2\) million for one month. Using its inventory as collateral, it can obtain a 12% (APR) loan. The lender requires that a warehouse arrangement be used. The...
-
What do you think is the optimum container ship size?
Study smarter with the SolutionInn App