For a given pair of words check if they are anagrams. Print
YES
if they are anagrams, or else print
NO
.
Two words are anagrams if one word can be obtained by the rearrangement of the characters in another word. Ex:
knee
and
keen
are anagrams
Note: All characters in the input will be in lower case.
you answered like this:
But this is actually calculating the area of a rectangle :
ex:
3 6
O X X X X X
O X X X X X
O X X X X X
def X_Only(Matrix:list):
for row in Matrix:
for cell in row:
# check if value is not X
if cell!='X':
return False
return True
def sub_size(lent:int):
for start in range(lent):
for stop in range(start+1, lent+1):
yield(start, stop)
def squareAreaWithX(matr:list, M:int, N:int):
maximum_area = 0
for begin_x, stop_x in sub_size(M):
for begin_y, stop_y in sub_size(N):
temp_matrix = [i[begin_y:stop_y] for i in matr[begin_x:stop_x]]
if X_Only(temp_matrix):
x= stop_x-begin_x
y= stop_y-begin_y
if maximum_area < x*y:
maximum_area=x*y
print(maximum_area)
while True:
s = input()
M, N = [int(i) for i in s.split()]
matrix=[]
for i in range(0,M):
matrix.append([N for N in input().split()])
squareAreaWithX(matrix, M, N)Given a sentence, write a program to rotate words longer than given length L by K letters towards the
right. Note: Even if K is greater than word length, rotate the word multiple times so that K letters will be rotated towards right.
Input
The first line of input will contain a string. The second line of input will contain two space separated integers, denoting L and K.
Output
The output should be a single line containing the sentence by rotating the words whose length is greater than L by K letters towards right.
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. Anti-diagonal elements are the set of elements of a matrix that lie on the line joining the bottom left corner to the top 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
The output should be MXN matrix by replacing elements that do not belong to principal-diagonal and anti-diagonal with Zeros. Print each row as a space separated integers in a single line.
Given a sentence, write a program to mix the words based on their index locations. The first word in the output should contain the first letter of each word in the given sentence and the second word should contain the second letter of each word in the given sentence and so on.
Note: The nth word in the output should contain th letter of each word in the given sentence. The letters of the output word should be in same order as the words in the given sentence. If a word in the given sentence doesn't have n-letters, you can skip it while considering the letters of the n-th word.
Input
The input will be a single line containing a string.
The output should be a single line containing the words by mixing based on their index locations.
K Sum Unique Combinations
Given a list of integers, write a program to print the count of all possible unique combinations of numbers whose sum is equal to K.
Input
The first line of input will contain space-separated integers. The second line of input will contain an integer, denoting K.
Output
The output should be containing the count of all unique combinations of numbers whose sum is equal to K.
Online Cake Ordering System: 1) Add a new order 2) Retrieve an order 3) Deliver an order 4) Print summary report 5) Exit system
+ a new order
Retrieve order
retrieve&remove the order (with nearest delivery data&time) from the binary heap data structure & update the status as “in progress” &move the order into queue data structure.
Deliver order
The user will retrieve a work in progress order from queue based on first in first out (FIFO) concept and move the order to a stack. Status of order will be updated as “delivered”.
View summary report
No built-in classes of data structure (heap, queue and stack) are allowed.
Dieting is common in our society and everyone wants a piece of the action. So many diets are available to choose from if someone wants to change their health; e.g., lose weight. Often times, diets are promoted with claims of great success.
For the purposes of this assignment, you are to choose a particular diet and analyze it in terms of scientific evidence, or lack thereof. Then, you are to design a controlled experiment to test a hypothesis based on this diet. The experiment must include multiple individuals within a control and experimental group. You must specify how you will measure the outcome of the experiment identifying both the independent and dependent variables. You must describe the potential outcomes of the experiment in terms of supporting the hypothesis.
Write a 2-3 page (500 – 750 words, 12 point font) paper including the following elements. Be sure to compose your work with your own words. Do not copy and paste from any source.
In your assigned readings, you learned how inductive and deductive reasoning are used to answer questions about life. Briefly compare and contrast each type of reasoning as they apply to biological investigation. Which, if any, type of reasoning is best used to establish cause and effect relationships? Explain your rationale using one or more examples.
Write a Python program using lists, function and loops that will prompt a user to enter a temperature as an integer. Your program will print "it is hot" if the temperature is over 100, "it is cold" if the temperature is under 60, and "it is just right" if the temperature is between 61 and 99 inclusive. The program continues to ask for temperatures, and evaluates them as above, until the user enters a temperature of 0 (to exit the program). An example of the anticipated program is shown below: Please enter a temperature: 95 It is just right. Please enter a temperature: 110 It is hot. Please enter a temperature: 32 It is cold. Please enter a temperature: 0 Good bye!