Mean, Median and Mode
Given a list of integers, write a program to print the mean, median and mode.
Mean - The average value of all the numbers.
Median - The mid point value in the sorted list.
Mode - The most common value in the list. If multiple elements with same frequency are present, print all the values with same frequency in increasing order.
Input
The input will be a single line containing space-separated integers.Output
The first line of output should contain the mean, round off the value to 2 decimal places.
The second line of output should contain the median, round off the value to 2 decimal places.
The third line of output should contain the mode.
Mean should always be a float value.
Median should be a float value when there are even number of elements, otherwise should be an integer value.
Sample Input 1
2 4 5 6 7 8 2 4 5 2 3 8
Sample Output 1
Mean: 4.67
Median: 4.5
Mode: 2
Sample Input 2
2 6 3 1 8 12 2 9 10 3 4
Sample Output 2
Mean: 5.45
Median: 4
Mode: 2 3
Given two dates D1 and D2, write a program to count the number of Saturdays and Sundays from D1 to D2 (including D1 and D2).
The date in string format is like "8 Feb 2021".Input
The first line of input will contain date D1 in the string format.
The second line of input will contain date D2 in the string format.Output
The output should be a single line containing two integers separated by space.Explanation
For example, if the given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are
"30 Jan 2021" is a Saturday
"31 Jan 2021" is a Sunday
"6 Feb 2021" is a Saturday
"7 Feb 2021" is a Sunday
"13 Feb 2021" is a Saturday
"14 Feb 2021" is a Sunday
So the output should be
Saturday: 3
Sunday: 3
Sample Input 1
25 Jan 2021
14 Feb 2021
Sample Output 1
Saturday: 3
Sunday: 3
Describe the difference between a chained conditional and a nested conditional. Give your own example of each.
Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.
Anti-Diagonals
Given a MxN matrix,write a program to print all Anti-Diagonals elements of matrix
Input
The first line of input will contain a M, N values separated by space.
The second line will contain matrix A of dimensions MxN.
Output
The output should contain anti-diagonal elements separated by a line.
Explanation
For example, if M = 4, N = 4
Matrix A:
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
So the output should be
a. Output "GREATER" if a given integer <num> is greater than 90.
Write a functionthat takes unsorted list as a parameter and return a sorted listin decending order(Do notuse any built-in function)
Create a list which contains the first three odd positive integers and a listbwhich contains the first three even positive integers.a= [1, 3, 5]b= [2, 4, 6]Create a new listcwhich combines the numbers from both lists (orderis unimportant).Find the Maximumvalue in list c (Donot use built-in function)Insert fourth element in listc42Append7,8and9to the end ofc.Print the first twoelements ofc.Print the last element ofbwithout using its length.Print the lengthofa
Mean, Median and ModeGiven a list of integers, write a program to print the mean, median and mode.
Mean - The average value of all the numbers.
Median - The mid point value in the sorted list.
Mode - The most common value in the list. If multiple elements with same frequency are present, print all the values with same frequency in increasing order.Input
The input will be a single line containing space-separated integers.Output
The first line of output should contain the mean, round off the value to 2 decimal places.
The second line of output should contain the median, round off the value to 2 decimal places.
The third line of output should contain the mode.
Mean should always be a float value.
Median should be a float value when there are even number of elements, otherwise should be an integer value.
See Sample Input/Output for the output format.Explanation
2 4 5 6 7 8 2 4 5 2 3 8The average of all the numbers is 4.67.
After sorting the array,
2 2 2 3 4 4 5 5 6 7 8 8
select five different plants study and select their different parts from the images of the selected parts classify those plants from other plants .before starting implementation select image processing and AI algorithms and discuss its equations the submission should include the Ai Algorithms used.
Replace Elements with Zeros
Given a MxN matrix, write a program to replace all elements that do not belong to principal-diagonal & anti-diagonal with Zeros.
Principal-diagonal elements are the set of elements of a matrix that lie on the line joining the top left corner to the bottom right corner.
Input
The first line of input will contain two space-separated integers, denoting MxN matrix.
The next M lines will contain N space-separated integers.
Output
Sample Input 1
5 5
4 3 7 6 4
4 4 7 7 6
9 5 8 5 9
3 6 6 2 4
3 7 4 4 3
Sample Output 1
4 0 0 0 4
0 4 0 7 0
0 0 8 0 0
0 6 0 2 0
3 0 0 0 3
Sample Input 2
10 10
73 18 100 29 91 98 5 45 16 18
11 25 81 76 95 71 22 80 81 11
28 82 87 24 65 43 21 4 47 98
99 30 62 87 30 60 80 33 71 38
61 15 64 4 86 39 49 24 95 100
78 45 30 87 28 9 75 50 3 75
Sample Output 2
73 0 0 0 0 0 0 0 0 18
0 25 0 0 0 0 0 0 81 0
0 0 87 0 0 0 0 4 0 0
0 0 0 87 0 0 80 0 0 0
0 0 0 0 86 39 0 0 0 0
0 0 0 0 28 9 0 0 0 0