Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

write a program to find if a given number is positive or negative in python


Matrix Rotation


You're given a square matrix A of dimentions N X n. You need to apply below 3 operations.


Rotation: It is represented as R S where S is an integer in {90,180,270...} which denotes the number of degrees to rotate .You need to rotate the matrix A by angle S in the clockwise direction.


The angle of rotation S will always be in multiples of 90 degrees.


Update: It is represented as U X Y Z. In initial matrix A , you need to update the element at row index X and column index Y with value Z.


Querying: It is represented as Q K L.You need to print the value at row index K and column index L of the matrix of the matrix A.




Sample Input 1


2


1 2


R 90


Q 0 0


Q 0 1


R 90


Q 0 0


U 0 0 6


Q 1 1


-1




Sample Output 1


3


1


4


6




Sample Input 2


2


5 6


7 8


R 90


Q 0 1


R 270


Q 1 1


R 180


U 0 0 4


Q 0 0


-1


Sample Output 2


5


8


8


In Python programming, compute the circumference of a circle given the radius entered by the user. The circumference of the circle is calculated as follows: (5 Points) C= 2πr


  1. What is wrong with the following statement that attempts to assign the value ten to variable x?

10=x


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]

This month is English month so everyday in class, a student must present his/her 'word of the day' and explain what it is. Today is Cody's turn, he decides to present the word 'apostrophe' and show them how it looks. Print an apostrophe for the class.


Develop a python application that will randomly select n intergers from 1 to 9 and will count and the numbers of accurance of the numbers without using the counter from collection library.







Sample output 1:







How many numbers?; 5







[4, 6, 8, 3, 3]







1-4







1-6







2-3







Sample output 2







How many numbers?: 7







[2, 6, 8, 2, 1, 1 , 6]







2-2







2-6







1-8







2-1






Develop a python application that will randomly select n intergers from 1 to 9 and will count and the numbers of accurance of the numbers without using the counter from collection library.



Sample output 1:



How many numbers?; 5



[4, 6, 8, 3, 3]



1-4



1-6



2-3



Sample output 2



How many numbers?: 7



[2, 6, 8, 2, 1, 1 , 6]



2-2



2-6



1-8



2-1






Matrix Program

you are given an m*n matrix.write a program to compute the perimeter of the matrix and print the result.Perimeter of a matrix is defined as the sum of all elements of the four edges of the matrix.


Input

The first line of input containing the positive integer.

The second line of input containing the positive integer.

The next N lines of input space-separated integers.


Explanation: The input should be

3

4

1 2 3 4

5 6 7 8

9 10 11 12


The output should be 65.


Sample Input1

4

4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16


Sample Output1

102



A teacher asked Ramesh to draw a Quadrilateral of a specific pattern with only symbol. The length and height should be L. Here L is the number of characters in every line. The height of the * quadrilateral is the number of lines it contains.

The slope of the quadrilateral taken as S represents the the number of extra space characters in a line when compared to its next line.

The last line will not have any space characters before the * character.


Sample Input1

6 9

Sample Output1

******

******

******

******

******

******



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS