Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input
The first line of input will contain a positive integer (N).
The following N lines will contain an integer in each line.Output
The output should be the sum of non-primes in the given numbers.Explanation
For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.
Prefix Suffix
Write a program to check the overlapping of one string's suffix with the prefix of another string.Input
The first line of the input will contain a string A.
The second line of the input will contain a string B.Output
The output should contain overlapping word if present else print "No overlapping".Explanation
For example, if the given two strings, A and B, are "ramisgood" "goodforall"
The output should be "good" as good overlaps as a suffix of the first string and prefix of next.
input:
ramisgood
godforall
output:
good
input-2:
finally
restforall
Prefix Suffix
Write a program to check the overlapping of one string's suffix with the prefix of another string.Input
The first line of the input will contain a string A.
The second line of the input will contain a string B.Output
The output should contain overlapping word if present else print "No overlapping".Explanation
For example, if the given two strings, A and B, are "ramisgood" "goodforall"
The output should be "good" as good overlaps as a suffix of the first string and prefix of next.
input
ramisgood
goodforall
ouput
good
input-2
finally
restforall
output:
No overlapping
Sum of Non-Primes
Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input
The first line of input will contain a positive integer (N).
The following N lines will contain an integer in each line.Output
The output should be the sum of non-primes in the given numbers.Explanation
For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.
Sum of Non-Primes
Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input
The first line of input will contain a positive integer (N).
The following N lines will contain an integer in each line.Output
The output should be the sum of non-primes in the given numbers.Explanation
For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.
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 = 2, N = 3
input
1 5 5
2 7 8
output:
1
5 2
5 7
8
Given a sentence S, write a program to print the frequency of each word in S, where words are sorted in alphabetical order.Input
The input will be a single line containing a string S.Output
The output contains multiple lines, with each line containing a word and frequency of each word in the given string separated by ": ", where words are sorted in alphabetical order.Explanation
For example, if the given sentence is "Hello world, welcome to python world", the output should be
Hello: 1
python: 1
to: 1
welcome: 1
world: 2
Polynomial
Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.
Input
The first line contains a single integer N.
Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.
Output
Print the polynomial in the format Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is coefficient, and C0 is constant. There will be space before and after the plus or minus sign.
If the coefficient is zero, then don't print the term.
If the term with the highest degree is negative, the term should represent -Cix^Pi.
For the term where power is 1, represent it as C1x instead of C1x^1.
If the polynomial degree is zero and the constant term is also zero, then print 0 to represent the polynomial.
For term Cix^Pi, if the coefficient of the term Ci is 1, print x^Pi instead of 1x^Pi.
Explanation
If N = 4
For power 0, the coefficient is 5
For power 1, the coefficient is 0
For power 2, the coefficient is 10
For power 3, the coefficient is 6.
Then polynomial represents "6x^3 + 10x^2 + 5"
Constraints
N <= 100
0 <= Pi < 1000
-1000 <= Ci <= 1000
25.0C
77.0F
298.0Kthis is expecetd output and when i enterded 37.5F iam getting value error
ValueError: invalid literal for int() with base 10: '37.5
Section 6.2 of your textbook describes incremental development. Do the exercise at the end of that section:
As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)
After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.
Include all of the following in your Learning Journal: