1.Convert the 1-D array to 3-D array
a = np.array([x for x in range(32)])
Answer:
print(o)
Output:
array([[[ 0, 1, 2, 3, 4, 5, 6, 7],
[ 8, 9, 10, 11, 12, 13, 14, 15]],
[[16, 17, 18, 19, 20, 21, 22, 23],
[24, 25, 26, 27, 28, 29, 30, 31]]])
2.Convert the value in the array to appropriate data type
a = np.array([[7.2, 5.4, 9.3],
[3.8, 6.7, 8.5]])
Answer:
print(o)
Output:
[[7 5 9]
[3 6 8]]
3.Extract value in between 7 to 15 from the given array
a = np.array([2, 6, 1, 9, 10, 3, 27])
Answer:
print(o)
Output:
[ 8 12 9 11]
Write Java statements that accomplish the following.
1. Declare int variables x and y.
2. Initialize an int variable x to 10 and a char variable ch to 'B'.
3. Update the value of an int variable x by adding 5 to it.
4. Declare and initialize a double variable payRate to 12.50.
5. Copy the value of an int variable firstNum into an int variable tempNum.
6. Swap the contents of the int variables x and y. (Declare additional variables, if
necessary.)
7. Suppose x and y are double variables. Output the contents of x, y, and the expression
x + 12 / y – 18.
8. Declare a char variable grade and set the value of grade to 'A'.
9. Declare int variables to store four integers.
10. Copy the value of a double variable z to the nearest integer into an int variable x
write a c ++ application to print out the numbres 10 through 49
write a programme that implements the following:
1- a class called shape which includes the height and the width as private attributes,
2- a derived class called rectangle which inherits the attributed from the shape and have a method called area which finds the area of the rectangle
3- a derived class called triangle which inherits the attributes from the shape and have a method called area that finds the area of the triabgle,
write a programme that implements the following:
1- a class called shape which includes the height and the width as private attributes,
2- a derived class called rectangle which inherits the attributed from the shape and have a method called area which finds the area of the rectangle
3- a derived class called triangle which inherits the attributes from the shape and have a method called area that finds the area of the triabgle,
Using exec system call list all the files and directories of home then
store the result in “output1.txt”. Run a second command “grep” and find
the word “output1.txt” in all the text files of the home also place home
path in “PATH” environment variable while doing exec for grep. This all
will be done in one process.
design a car model class under package :package 3 with the following attributes: member field name licence number model current mileage engine size type string string double integer mark all the attributes as private & create appropriate getters & setters design another class as mainunder package :package3, where you need to implement logic as follows: you need to take the number of cars as input and then take each car's necessary information and put them in array. then at end show them in well-designed format.
Declare a variable to store text values.
We have to calculate the area of a rectangle, a square and a circle. Create an abstract class 'Shape' with three abstract methods namely 'RectangleArea' taking two parameters, 'SquareArea' and 'CircleArea' taking one parameter each. The parameters of 'RectangleArea' are its length and breadth, that of 'SquareArea' is its side and that of 'CircleArea' is its radius. Now create another class 'Area' containing all the three methods 'RectangleArea', 'SquareArea' and 'CircleArea' for printing the area of rectangle, square and circle respectively. Create an object of class 'Area' and call all the three methods.
Write a program that calculates and prints the bill for a cellular telephone company.