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

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.


Sample Input 1

ramisgood

goodforall


Sample Output 1

good


Sample Input 2

finally

restforall


Sample Output 2

No overlapping




Given the weekday of the first day of the month, determine the day of the week of the given date in that month.

Input

The first line is a string D.

The second line is an integer N.

Output

The output should be a string.

Explanation

In the given example,

D = Monday. As the 1st of the day of the month is a Monday, it means the 7th and 14th of the month will also be Mondays (A week has 7 days). So the 16th day (N = 16) of the month will be a Tuesday. So, the output should be

Tuesday.


Sample Input 1

Monday

16


Sample Output 1

Tuesday


Sample Input 2

Tuesday

17


Sample Output 2

Thursday







Write a Python program that reads an integer representing a month of the year, and
then print the name of the month. Your program must include validation and error
handling code. Thus, if the user enters a value outside the range of 1-12; or characters
that cannot be converted to an integer, your code must print the appropriate
message and continue without crashing. (Hint: You may NOT USE any 'if' statements.)
Examples:
# Input: -5 Output: Please enter a number between 1 and 12:
# Input: gkl Output: Please enter numbers only
# Input: 6 Output: June [40]

Write a Python function called sumList () which will receive a list of integers as input parameter. sumList() must: a) Print the list b) Sum all the numbers in a list and print the total. The main section of your program must: c) Ask the user how many numbers the list should contain; d) Create the list accordingly (containing randomly generated integers between 0 and 100); e) Pass the list to sumList () for processing. Example output if a list containing four numbers is passed to sumList() [3, 47, 94, 1]. The total is: 145 


Write a python function called sumList() which will receive a list of integers as an input parameter. sumList must : print the list, sum all the numbers in a list and print the total. Programs main section must ask the user how many numbers the list should contain and create the list accordingly to contain randomly generated integers between 0 and 10. The list should be passed to sumList() for processing. Example output if the list containing 5 numbers is passed to sumList()
[2,45,78,56,32]
The total is: 213

Write a python program that prompts the user to enter a sentence of at least 5 words. Include a test to ensure that the user has entered at least 5 words. Store the individual words as separate items in a list. Print the sentence in reverse order - word for word. The word must print in one line (not beneath each other) and spaces must be inserted between the words. The sentence must be printed in reverse order example: "Where is the mountain" - "niatnuom eht si erehW"


1. Write a Python program that prompts the user to enter a sentence of at least 5 words. Include a test to ensure that the user has entered at least 5 words. Store the individual words as separate items in a list. Print the sentence in reverse order - word by word. The words must print in one line (not beneath each other). Insert spaces between the words. Example: "What is the best song right now" > "now right song best the is What" Print the sentence in reverse order - letter by letter. The words must print in one line (not beneath each other). Insert spaces between the words. # Example: "What is the best song right now" > "won thgir gnos tseb eht si tahW" 


Write a Python function called sumList () which will receive a list of integers as input parameter. sumList() must: a) Print the list b) Sum all the numbers in a list and print the total. The main section of your program must: c) Ask the user how many numbers the list should contain; d) Create the list accordingly (containing randomly generated integers between 0 and 100); e) Pass the list to sumList () for processing. Example output if a list containing four numbers is passed to sumList() [3, 47, 94, 1]. The total is: 145


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







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


And out put should be in matrix and should not contain "[]" brackets


LATEST TUTORIALS
APPROVED BY CLIENTS