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 your file 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
Input:
01231
Output:
10
example 2
Input:
891
Output:
73
example 3
Input:
0000
Output:
example 4
Input:
45f
Output:
Invalid Number
Date format 2
Input
200
Output
3 minutes 20 seconds
Question 7
X = np.array([
[10,20,30],
[40,50,60],
[70,80,90]])
Answer:
print(X)
array([20, 50, 50])
Question 8
Y = np.array([
[3,6,9,12],
[15,18,21,24],
[27,30,33,36],
[39,42,45,48],
[51,54,57,60]])
Answer:
Question 8 Output
array([[ 3, 12],
[27, 36],
[51, 60]])
Question 9
print("Original array:")
Answer:
print(x)
>>>array([ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
print(“Remove even numbers from the array x: “)
Answer:
print(x)
>>>array([12, 14, 16, 18, 200])
print(“Replace all odd numbers in array x with -10:”)
Answer:
print(x)
>>> array([ 12, -10, 14, -10, 16, -10, 18, -10, 20])
Question 10
print("Original array:")
Answer:
>>> print(X)
[10 12 14 16 18 20 22 24 26 28 30]
>>> print(Z)
[10 12 14 16 18 20 22 24 26 28 30]
Answer:
>>> print(X)
[0 2 4 6 18 20 22 24 26 28 30]
Answer:
>>> print(Z)
[10,12,14,16,-18,-20,-22,-24,26,28,30]
Question 4
Answer:
Question 4 Output
array([8 10 12 14 16 18 20])
Question 5
print("Original array:")
Answer:
print(x)
>>>[12 13 14 15 16 17 18 19]
print("Reverse array:")
Answer:
>>>array([19, 18, 17, 16, 15, 14, 13, 12])
Question 6
x = [11, 12, 13]
print("Original array:")
print(x)
Answer:
print("After append values to the end of the array:")
print(x)
Question 6 Output
Original array:
[11,12,13]
After append values to the end of the array:
[21 22 23 24 31 32 33 34]
Question 1
a = np.array([[11,22,34],
[48,56,60]])
b = np.array([[18,69,87],
[52,26,35]])
Answer:
Question 1 Output:
array([[29,91,121],
[100,82,95]])
Question 2
a = np.array([[8,9,10],
[25,35,58]])
Answer:
Question 2 Output
array([[24,27,30],
[75,105,174]])
Question 3
x = np.zeros(10)
print(x)
print("Update eighth value to 11")
Answer:
print(x)
Question 3 Output
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
Update fifth value to 66 and eighth value to 45
[0. 0. 0. 0. 0. 66. 0. 0. 45. 0.]
Area of Largest Rectangle in Histogram
Input
215623
Roman numerals
Input
2
Palindrome Pairs
Sample input
Was it car or a cat i saw
Closest palindrome number
Sample input
19
Sample output
22
In the examination, Rajiv is asked to write a python function to demonstrate the use of the "+" operator. During the examination, Rajiv got confused that either he needs to add two numbers using "+" or concatenate two strings. So, Rajiv decided to implement both cases in his python code. Your task is to help Rajiv by writing a python function Add_Values(a,b)