Given a string of numbers S, the task is to find the maximum value from the string S, you can add a ‘+’ or ‘*’ sign between any two numbers.
For example, S=891. As 8*9*1 = 72 and 8*9+1 = 73. So, 73 is maximum.
Write a python module MaxValue.py for solve the above task. You need to import this module in RollNo_W12B_1.py. In RollNo_W12B_1.py, define a function Find_Max(n) which takes a string and return maximum value or error message as shown in example by calling the appropriate function implemented in MaxValue.py module. Also handle the possible exceptions and display the exception message in form of string.
Example-1
Example-2
Example-3
Example-4
Input:
01231
Output:
10
Input:
891
Output:
73
Input:
0000
Output:
Input:
45f
Output:
Invalid Number
Create a simple Python Program about concert ticketing system that allows users who are 18 years old to buy tickets. The ticket prices are as follows.
VIP- 4,500
Patron- 3500
Box regular- 2500
Friend and Enemy
A group of F friends went to a haunted house.Each member was given a shirt with a number on it ranging from 1 to F. As they entered the haunted house, one of them was kidnapped and an enemy joined them.But unfortunately, the enemy didn't wear the shirt with the same number as the kidnapped one, instead wore the same as some other person.Find the numbers on the shirts of the enemy and the kidnapped person.
Input
The input is a single line containing space-separated positive integers from 1 to F.
Output
The output should be a single line containing the shirt numbers of the enemy and kidnapped person separated by a space.
Explanation
The given array is 3 1 5 2 1.
In the range from 1 to 5, the number 1 has occured twice and 4 is the missing number. So, 1 belongs to the enemy's shirt, and 4 belongs to kidnapped.Hence, the output should be 1 4.
Sample Input1
3 1 5 2 1
Sample Output1
1 4
Sample Input2
1 2 2 4
Sample Output2
2 3
Sum of Non-Diagonals
As the creative content member of your newspaper company, you are given the task to publish a puzzle in your local newspaper. For a given MxM integer matrix, the task is to print the sum of all elements other than the diagonal elements,Both the diagonals are to be excluded.
Input
The first line of input is a positive integer M.
The next M lines of input contain M space-separated integers.
Output
The output is an integer that represents the sum of all the numbers in the matrix as mentioned above.
Sample Input1
3
4 1 3
2 5 6
1 2 3
Sample Output1
11
Sample Input2
5
1 2 2 3 3
4 4 5 6 7
9 8 7 6 5
9 2 3 8 8
-4 -2 -2 4 -7
Sample Output2
63
question: highest investor
ramsay is a stock broker , and N people have given him money to invest in stocks. some one may invest more money in an year. To than the person who invested most with ramsay he will send a gift at the end of the year . In case of a tie he will pick the person with the smallest lexicographic name.
Note:-
input :-
5
Harry 500
Andrew 300
Mary 1000
Jane 400
Tobey 1000
output:-
Mary 2
explanation output:- both tobey and mary have the biggest investment . as mary is smallest in lexicographic name than tobey and found at index 2 the output is "mary 2"
a square matrix A of dimensions NxN. You need to apply the below given 3 operations on matrix A.
Rotation: It represented as R S where S is integer in {90, 180, 270, 360, 450, .} which denotes the number of degrees to rotate. You need to rotate matrix A by angle S in the clockwise 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.
Query: It is represented as Q K L. need to print the value at row index K and column index L of the matrix A.
Next N lines contain N space-separated integers Aij (i - index row, j - index of column)
-1 will represent the end of input.
S Input:
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
op:
5
8
8
Your younger brother is studying in school. His computer teacher gives homework to make a calculator for six operations: addition, subtraction, multiplication, division, power, and modulo on two integers. As you are about to become an engineer, so he expected help from your side to develop the program. Therefore, write Calc.py module that define a separate function for implementing all the above-mentioned operations. Then import Calc.py in your RollNo_W12A_1.py file. In RollNo_W12A_1.py, define a function Arithmatic(a, b, op) which calls the respected function defined in Calc.py to perform the required operation. Also handle the possible exceptions and display the exception message in form of string
Friend and Enemy
A group of F friends went to a haunted house.Each member was given a shirt with a number on it ranging from 1 to F. As they entered the haunted house, one of them was kidnapped and an enemy joined them.But unfortunately, the enemy didn't wear the shirt with the same number as the kidnapped one, instead wore the same as some other person.Find the numbers on the shirts of the enemy and the kidnapped person.
Input
The input is a single line containing space-separated positive integers from 1 to F.
Output
The output should be a single line containing the shirt numbers of the enemy and kidnapped person separated by a space.
Explanation
The given array is 3 1 5 2 1.
In the range from 1 to 5, the number 1 has occured twice and 4 is the missing number. So, 1 belongs to the enemy's shirt, and 4 belongs to kidnapped.Hence, the output should be 1 4.
Sample Input1
3 1 5 2 1
Sample Output1
1 4
Sample Input2
1 2 2 4
Sample Output2
2 3
Sum of Non-Diagonals
As the creative content member of your newspaper company, you are given the task to publish a puzzle in your local newspaper. For a given MxM integer matrix, the task is to print the sum of all elements other than the diagonal elements,Both the diagonals are to be excluded.
Input
The first line of input is a positive integer M.
The next M lines of input contain M space-separated integers.
Output
The output is an integer that represents the sum of all the numbers in the matrix as mentioned above.
Sample Input1
3
4 1 3
2 5 6
1 2 3
Sample Output1
11
Sample Input2
5
1 2 2 3 3
4 4 5 6 7
9 8 7 6 5
9 2 3 8 8
-4 -2 -2 4 -7
Sample Output2
63
There are N intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at S number of these intermediate stations so that no two stopping stations are consecutive. Write a python module Station.py for above and import the module , define a function Get_Stations(N, S) which takes value of N & S and return integer result as shown in example by calling the appropriate function implemented in Station.py module. Also handle the possible exceptions and display the exception message in form of string.
Example-1
Example-2
Example-3
Input:
12
4
Output:
126
Input:
16
5
Output:
792
Input:
2
4
Output:
No Station