Write a function called Matrix_ mul that takes two 2D list( matrix es) of 3x3named A & B as a parameter and multiplication result of these two matrix
Write a function called Matrix_mul that takes two 2D list(matrixes) of 3x3named A & B as a parameter and multiplication result of these two matrix
Write a function called print_matrix that takes a 2D list(matrix) of 3x3 as a parameterand prints the values in matrix shape.
Write a function that takes a 2D list(matrix) of 3x3 and ask user to input the values
a) Write a function that takes a 2D list(matrix) of 3x3 and ask user to input the
values
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B
Output
Print the addition of polynomials A and B.
If the degree of polynomial is zero and the constant term is also zero, then just print 0 to represent the polynomial.
Test Case 1:-
Input:-
6
0 -20
1 23
2 30
3 19
4 6
5 17
9
0 -100
5 -89
6 -20
7 -1
1 20
2 4
3 99
4 -45
8 12
Output:-
12x^8 - x^7 - 20x^6 - 72x^5 - 39x^4 + 118x^3 + 34x^2 + 43x - 120
Note :- Need Space between - and + operators
Test Case 2:-
Input:-
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
Output :-
6x^3 + 14x^2 + 2x + 6
Note:- Need Space between - and + operators
Test Case 3:- Test Case 4:-
Input:- Input:-
5 4
0 -2 0 5
3 6 1 0
4 7 2 10
1 -3 3 6
2 -1 4
5 0 -5
0 1 1 0
1 2 2 -10
2 -4 3 -6
3 3 Output:-
4 5 0
Output:-
12x^4 + 9x^3 - 5x^2 - x - 1
Note:- Need Space between - and + operators
We need all 4 test cases can be came when code was run. I want exact outputs for all test cases
2. Create a function that has 5 parameters. This function will calculate the average grade of 5 subjects.
The 5 grades on each subject should be 1 line of user input.
sample output:
Enter 5 Grades: 70 72 73 74 60
Your average grade is 69.8 and you are failed.
Activity:
1. FizzBuzz
Create a program that will display numbers 1-31. When the number Is divisible by 3, it will print Fizz besides
the number. But when the number is divisible by 5, it will print buzz besides the number. But if the number is
divisible by 3 and 5, it will print FizzBuzz besides the number.
Sample output:
1
2
3fizz
4
5buzz
6fizz
7
8
9fizz
10buzz
11
12fizz
13
14
15fizzbuzz
16
17
18fizz
19
20buzz
21fizz
22
23
24fizz
25buzz
26
27fizz
28
29
30fizzbuzz
1. Consider the loop from Section 8.3 of your textbook.
prefixes = 'JKLMNOPQ'
suffix = 'ack'
for letter in prefixes:
print(letter + suffix)
Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".
Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same.
Include the modified Python code and the output in your submission.
2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example. Invent your own examples. Do not copy them for the textbook or any other source.
Part 2
Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a).
a = 6 | my_sqrt(a) = 2.44948974278 | math.sqrt(a) = 2.44948974278 | diff = 0.0
a = 7 | my_sqrt(a) = 2.64575131106 | math.sqrt(a) = 2.64575131106 | diff = 0.0
a = 8 | my_sqrt(a) = 2.82842712475 | math.sqrt(a) = 2.82842712475 | diff = 4.4408920985e-16
a = 9 | my_sqrt(a) = 3.0 | math.sqrt(a) = 3.0 | diff = 0.0
Modify your program so that it outputs lines for a values from 1 to 25 instead of just 1 to 9.
You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted.