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

Which of the following are not viewed as principles guiding design?

  1. Motor activity
  2. Problem solving
  3. History
  4. Perception
  5. Language and communication
Numbers in String - 2
Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters.
Input

The input will be a single line containing a string.
Output

The output should contain the sum and average of the numbers that appear in the string.
 Note: Round the average value to two decimal places.
Explanation

For example, if the given string is "I am 25 years and 10 months old", the numbers are 25, 10. Your code should print the sum of the numbers(35) and the average of the numbers(17.5) in the new line.
Sample Input 1
I am 25 years and 10 months old
Sample Output 1
35
17.5

Sample Input 2
Tech Foundation 35567
Sample Output 2
35567
35567.0


Numbers in String - 1
Given a string, write a program to return the sum and average of the digits of all numbers that appear in the string, ignoring all other characters.
Input

The input will be a single line containing a string.
Output

The output should contain the sum and average of the digits of all numbers that appear in the string.
 Note: Round the average value to two decimal places.
Explanation

For example, if the given string is "I am 25 years and 10 months old", the digits of all numbers that appear in the string are 2, 5, 1, 0. Your code should print the sum of all digits(8) and the average of all digits(2.0) in the new line.
Sample Input 1
I am 25 years and 10 months old
Sample Output 1
8
2.0

Sample Input 2
Tech Foundation 35567
Sample Output 2
26
5.2
Ordered Matrix
Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.
Input

The first line of input will contain two space-separated integers, denoting the M and N.
The next M following lines will contain N space-separated integers, denoting the elements of each list.
Output

The output should be M lines containing the ordered matrix.
Note: There is a space at the end of each line.
Explanation

For example, if the given M is 3 and N is 3, read the inputs in the next three lines if the numbers given in the next three lines are the following.

1 20 3
30 10 2
5 11 15


By ordering all the elements of the matrix in increasing order, the ordered matrix should be

1 2 3
5 10 11
15 20 30

Sample Input 1
3 3
1 20 3
30 10 2
5 11 15
Sample Output 1
1 2 3 
5 10 11 
15 20 30 

Sample Input 2
2 5
-50 20 3 25 -20
88 17 38 72 -10
Sample Output 2
-50 -20 -10 3 17 
20 25 38 72 88 


Write a function called is_identity that takes a 2D list(matrix) of 3x3 as a parameter and return true or false if the matrix is identity matrix or notasquare matrix in which all the elements of the principal diagonal are ones and all other elements are zeros.


rite a function called diagonal_sum that takes a 2D list(matrix) of 3x3as a parameter andprints its Left diagonal sumand Right diagonal sum


Write a function called Matrix_mul that takes two 2D list(matrixes) of 3x3named A & B as a parameter and multiplication result of these two matrix


function called print_matrix that takes a 2D list(matrix) of 3x3 as a parameterand prints the values in matrixshape.


Write a function called is_identity that takes a 2D list(matrix) of 3x3 as a parameter and return true or false if the matrix is identity matrix or not a square matrix in which all the elements of the principal diagonal are ones and all other elements are zeros.


Write a function called diagonal_sum that takes a 2D list(matrix) of 3x3as a parameter and prints its Left diagonal sum and Right diagonal sum


LATEST TUTORIALS
APPROVED BY CLIENTS