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

We run the "Word mix" code , The output will be lie this


The nth word in the output should contain nth 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.


Ex: Input :: Welcome to your first problem


Output :: Wtyfp eooir luro crsb otl me em


Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.


Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.


abcdefghijklmzyxwvutsrqpon nopqrstuvwxyzmlkjihgfedcba



Rotate Matrix Rings


The below url contains code for Rotate Matrix Rings

https://drive.google.com/file/d/1Kn65dh5pVUlIQShr4w7aHSZVNPPpCASF/view?usp=sharing


In the above url link it contains code while running code this error was showing as below


Enter M: 


Traceback (most recent call last):

 File "main.py", line 1, in <module>

  M = int(input("Enter M: "))

ValueError: invalid literal for int() with base 10: '3 4\r'


And also not coming expected test cases. The test cases are below


Test case 1

Input:-

4 4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

3

Output:-

13 9 5 1

14 7 11 2

15 6 10 3

16 12 8 4


Test case 2

Input:-

3 4

1 2 3 4

10 11 12 5

9 8 7 6

2

Output:-

9 10 1 2

8 11 12 3

7 6 5 4


We need all test cases can be came when code was run. I want exact outputs for all test cases



The link below is the question

I already try coding it but I can't come up with the output. Can you please help me with it and correct it.

I needed it already. Thank you.


https://www.chegg.com/homework-help/questions-and-answers/create-python-program-would-perform-given-description-program-description-different-countr-q78177521

First part of code:

dict1 = {'a':2,'b':2,'c':2,'d':3,'e':3,'f':3,'g':4,'h':4,'i':4,'j':

5,'k':5,'l':5,'m':6,'n':6,'o':6,'p':7,'q':7,'r':7,'s':7,'t':8,'u':

8,'v':8,'w':9,'x':9,'y':9,'z':9}


def convert(word):

  x = 0

  for i in range(0,len(word)):

    ch = word[i]

    x = x * 10 + dict1[ch]

    return x


Smaller Scores

A group of people(P) are playing an online game. Their scores are stored in the order of their entry time in S. Each integer S[i] corresponds to the score of the person Pi.


For each person Pi you have to report the number of people who played after the person and scored less than the person.


Input

The first line contains a single integer N.

The second line contains N space-separated


Output

The output should contain N space-separated integers representing the number of people who played after the person and scored less than the person.


Explanation

Given S = 13 12 11


Score of P1 is 13.

Score of P2 is 12.

Score of P3 is 11.


The number of people who played after P1 and scored less than 13 is 2(12, 11).

The number of people who played after P2 and scored less than 12 is 1(11).

The number of people who played after P3 and scored less than 11 is 0.


The output is 2 1 0.


Sample Input 1

3

13 12 11

Sample Output 1

2 1 0

Sample Input 2

4

4 3 5 2

Sample Output 2

2 1 1 0



Area of Rectangle

Given an MxN matrix filled with


X's and O's, find the largest rectangle containing only X's and return its area. If there are no Xs in the entire matrix print 0.Input

The first line of input will be containing two space-separated integers, denoting M and N.

The next M lines will contain N space-separated integers, denoting the elements of the matrix.


Output

The output should be a single line containing the area of the maximum rectangle.


Explanation

For example, if the given M, N and elements of matrix are as the following


4 5

X O X O O

X O X X X

X X X X X

X O O X O


The matrix from indices (1, 2) to (2, 4) has the maximum rectangle with

X. So the output should be the area of the maximum rectangle with X, which is 6.


Sample Input 1

4 5

X O X O O

X O X X X

X X X X X

X O O X O


Sample Output 1

6


Sample Input 2

3 3

O X X

O X X

O O O


Sample Output 2

4



Non-Adjacent Combinations of Two Words


Write a Python Program of Non-Adjacent Combinations of Two Words


The Question and test cases are given below link


https://drive.google.com/file/d/1BAzikXzPal2JOSNLSXuxx2lASwEb-cpF/view?usp=sharing


Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.


Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.


abcdefghijklmzyxwvutsrqpon nopqrstuvwxyzmlkjihgfedcbaInput


The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output


The output should be a single line containing the secret message. All characters in the output should be in lower case.

Explanation

.

Sample Input 1

python

output

kbgslm

input2

python learning

output2

kbgslm ovzimrmt




Create a Python dictionary that returns a list of values for each key. The key can be whatever type you want. 

Design the dictionary so that it could be useful for something meaningful to you. Create at least three different items in it. Invent the dictionary yourself. Do not copy the design or items from some other source. 

Next consider the invert_dict function from Section 11.5 of your textbook. 

# From Section 11.5 of: 

# Downey, A. (2015). Think Python: How to think like a computer scientist. Needham, Massachusetts: Green Tree Press. 

def invert_dict(d):

   inverse = dict()

   for key in d:

      val = d[key]

     if val not in inverse:

        inverse[val] = [key]

     else:

        inverse[val].append(key)

   return inverse 



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.


LATEST TUTORIALS
APPROVED BY CLIENTS