You are given a square matrix A of dimensions NxN. You need to apply the below given 3 operations on the matrix A.
Rotation: It is represented as R S where S is an integer in {90, 180, 270, 360, 450, ...} 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 (as given in input), you need to update the element at row index X and column index Y with value Z.
After the update, all the previous rotation operations have to be applied to the updated initial matrix.
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 A.
Write a program to create a menu-driven calculator that performs basic arithmetic operations (+, -, *, /, and %).Input
The input will be a single line containing two integers and operator(+, -, *, /, and %) similar to 3 + 5.Output
If the given operator is "+", print the sum of two numbers.
If the given operator is "-", print the result of the subtraction of the two numbers.
If the given operator is "*", print the multiplication of the two numbers.
If the given operator is "/", print the result of the division of the two numbers.
If the given operator is "%", print the result of the modulus operation of the two numbers.Explanation
For example, if the given operator is "+" and the two numbers are 3 and 5. As it is an addition operator, your code should print the sum of the given two numbers (3 + 5), which is 8.
Similarly, if the given operator is "*" and the two numbers are 2 and 5.
As it is a multiplication operator, your code should print the result of the multiplication of the given two numbers (2 * 5), which is 10.
Similarly, if the given operator is "-" and the two numbers are 10 and 9.
As it is a subtraction operator, your code should print the result of the subtraction of the given two numbers (10 - 9), which is 1.
Similarly, if the given operator is "%" and the two numbers are 20 and 10.
As it is a Modulus operator, your code should print the result of the remainder of the given two numbers (20 % 10), which is 0.
Write a program to print the absolute difference between the two given numbers. (Absolute difference is the difference without the negative sign)
Given a positive integer, write a program to print the digit in its one's place
For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K
Given a dictionary that tells you a person's major, write a Python function that, given a person's name and a major, returns `True` if that person is majoring that subject, and `False` otherwise. Also return false if the student is not in the list of students.
Given the number of rows N, write a program to print the hallow diamond pattern similar to the pattern shown below.
A
B B
C C
D D
E E
D D
C C
B B
AThe input will be a single line containing a positive integer (N).Output
The output should be (2*N - 1) rows and (2*N - 1) columns containing the alphabet characters in the hollow diamond pattern.Explanation
For example, if the given number is 5, the pattern should contain 9 rows and 9 columns as shown below.
A
B B
C C
D D
E E
D D
C C
B B
ANOTE:
NO SPACES ON LEFT SIDE FOR DIAMOND
Word Count
Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.
Input
The input will be a single line containing a sentence S.
Output
The output contains multiple lines, with each line containing a word and its count separated by ": " with the order of appearance in the given sentence.
Prefix Suffix
Write a program to check the overlapping of one string's suffix with the prefix of another string.
Input
The first line of the input will contain a string A.
The second line of the input will contain a string B.
Output
The output should contain overlapping word if present else print "No overlapping".
Polynomial
Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.
Input
The first line contains a single integer N.
Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.
Output
Print the polynomial in the format Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is coefficient, and C0 is constant. There will be space before and after the plus or minus sign.
If the coefficient is zero, then don't print the term.
If the term with the highest degree is negative, the term should represent -Cix^Pi.
For the term where power is 1, represent it as C1x instead of C1x^1.
If the polynomial degree is zero and the constant term is also zero, then print 0 to represent the polynomial.
For term Cix^Pi, if the coefficient of the term Ci is 1, print x^Pi instead of 1x^Pi.
Explanation
If N = 4
For power 0, the coefficient is 5
For power 1, the coefficient is 0
For power 2, the coefficient is 10
For power 3, the coefficient is 6.
Then polynomial represents "6x^3 + 10x^2 + 5"
Constraints
N <= 100
0 <= Pi < 1000
-1000 <= Ci <= 1000
Sample Input
4
0 5
1 0
2 10
3 6
Sample Output
6x^3 + 10x^2 + 5