Answer:
import numpy as np
a = int(input ("Enter a"))
b = int(input ("Enter b"))
c = int(input ("Enter c"))
d = int(input ("Enter d"))
c1 = int(input ("Enter c1"))
c2 = int(input ("Enter c2"))
array1 =[[a, b],[c, d]]
A = np.array (array1)
B = np.array ([c1, c2])
X = np.linalg.inv (A).dot (B)
print (X)
Explanation:
let ax + by =c1
cx + dy =c2
We have used the above NumPy library that has the methods for matrix calculation, and here we have used matrix multiplication, and the inverse of a matrix to find the value of x and y.
We know AX=B
X = inv A. B
And this we have used above. We can calculate inv A and do matrix multiplication using NumPy. And thus we get the above solution.
Answer:
8/3 hours
Explanation:
For this question, let us say that 1 job contains 240 files
Computer X does this job in 4 hours
Computer Y does the same job in 8 hours
All we need to find is how long it will take both computers to finish the job
Now we apply the basic combined work formula, which is
Combined Time = (time a * time b)/(time a + time b)
And we known that time a = 4 hrs,
We then substitute this values into the equation to get
Combined time = (4*8)/(4+8)
= 32/12
= 8/3 hours
Answer:
The algorithm:
Input days
sum = 0
for i = 1 to
input text
sum = sum + text
end for
average = sum/days
print average
The program in pascal:
var days, sum, text, i:integer;
var average : real;
Begin
write ('Days: '); readln(days);
sum:=0;
for i := 1 to do
write ('Text: '); readln(text);
sum:=sum+text;
end;
average := (sum/days);
writeln ('The average text is' , average);
End.
Explanation:
This declares all variables
var days, sum, text, i:integer;
var average : real;
This begins the program
Begin
This gets the number of days from the user
write ('Days: '); readln(days);
Initialize sum to 0
sum:=0;
This iterates through the days
for i := 1 to do begin
This gets the text for each day
write ('Text: '); readln(text);
This sums up the texts
sum:=sum+text;
End loop
end;
Calculate average
average := (sum/days);
Print average
writeln ('The average text is' , average);
End program
End.
Ump will be assigned to word2
word1[0:3] gets all of the letters from index 0 to index 3 exclusive (that means index 3 is not included)