You are given an m*n matrix.write a program to compute the perimeter of the matrix and print the result.Perimeter of a matrix is defined as the sum of all elements of the four edges of the matrix.
Input
The first line of input containing the positive integer.
The second line of input containing the positive integer.
The next N lines of input space-separated integers.
Explanation
The input should be
3
4
1 2 3 4
5 6 7 8
9 10 11 12The output should be 1+2+3+4+8+12+11+10+9+5 = 65
Sample Input1
3
4
1 2 3 4
5 6 7 8
9 10 11 12
Sample Output1
65
Write a program to print a parallelogram pattern with * characters. The size N represents the length (the number of * characters in each line)& breadth ( the number of lines) of the parallelogram.
The slope of the parallelogram T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.
Explanation:
Given N=3 and T=2
Each line should have 3 star(*) characters.
The last line should have 0 spaces at the beginning.
Each line has 2 extra spaces characters when compared to its next line.
Sample Input1
2
2
Sample Output1
**
**
Sample Input2
3
2
Sample Output2
***
***
***
Akshya is given a list of N integers. Each number in the list appears exactly for one number. help akshya by identifying the numbers which appeared exactly once in the list.
Input
The input contains a single-line comma-separated integers.
Output
The output contains a single-line comma-separated integers.
Sample Input1
8,9,5,8,5,6
Sample Output1
9,6
Sample Input2
1,2,3,4,5,1,2,3,4
Sample Output2
5
Andy has the word W and he wants to print the unique characters in the word in the order of their occurrence.write a program to help Andy print the unique characters as described above.
NOTE : consider lower and upper case letters as different
Input
The input is a single line containing the word W.
Output
The output should be a single line containing space separated characters.
Explanation
In the example, the word is MATHEMATICS
The unique characters in the given word are M, A, T, H, E, I, C, S, in the order of occurrence.so the output should be M A T H E I C S.
Sample Input1
MATHEMATICS
Sample Output1
M A T H E I C S
Sample Input2
banana
Sample Output2
b a n
Write a Python program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list. It should have the following functions:
The program should call the functions mentioned above and display the lowest, highest and total values in the list. It should also calculate and display the average of the numbers in the list
def mystery1(x):
return x + 2
def mystery2(a, b = 7):
return a + b
#MAIN
n = int(input("Enter a number:"))
ans = mystery1(n) * 2 + mystery2 (n * 3)
print(ans)What is output when the user enters 3?
Write a program to accept an integer amount from user and tell minimum number of notes needed for representing that amount.
Suppose you are given two dictionaries. Now create a new dictionary "marks", merging the two dictionaries, so that the original two dictionaries remain unchanged. Note: You can use dictionary functions. =================================================================== Given: {'Harry':15, 'Draco':8, 'Nevil':19} {'Ginie':18, 'Luna': 14} Output: {'Harry': 15, 'Draco': 8, 'Nevil': 19, 'Ginie': 18, 'Luna': 14} =================================================================== Given: {'A':90, 'B': 0} {'C':50} Output: {'A': 90, 'B': 0, 'C': 50}
Using a class to represent the planet and its gravity, develop a program that outputs the user's weight on different planets.
Write a Python program that asks the user to enter a store’s sales for each day of the week. The sales amounts should be stored in a list. Use a loop to calculate the total sales for the week and display the result. Do not use built-in Python function like sum to perform the calculation