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

Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.


Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.




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.

For example, if the given input is "python", "p" should replaced with "16", similarly"y" with "25","t" with "20","h" with "8","o" with "15","n" with "14". So the output should be "16-25-20-8-15-14".


Sample Input 1 :

python


Sample Output 1 :

16-25-20-8-15-14


Sample Input 2 :

Foundations


Sample Output 2 :

6-15-21-14-4-1-20-9-15-14-19




Print in Reverse Order - 2


This Program name is Print in Reverse Order - 2. Write a Python program to Print in Reverse Order - 2, it has two test cases


The below link contains Print in Reverse Order - 2 question, explanation and test cases


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


We need exact output when the code was run

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'.


a b c d e f g h i j k l m n o p q r s t u v w x y z

z y x w v u t s r q p o n m l k j i h g f e d c b a

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


All characters in the output should be in lower case.

Explanation


if the given input is "python", "p" should replaced with "k", similarly "y" with "b", "t" with "g", "h" with "s", "o" with "l", "n" with "m". So the output should be "kbgslm".

Sample Input 1:

python


Sample Output 1 :

kbgslm


Input 2 :

Foundations


Output 2 :

ulfmwzgrlmh




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




Write a program to print the count of all possible unique combinations of numbers whose sum is equal to K


Write a program to replace elements with zeros


Write a program to find the minimum number of notes required for the amount M. Available note denominations are 500, 50, 10, 1.

Given

M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be

500: 3 50: 0 10: 4 1: 3


sample input=1543 output is 500: 3 50: 0 10: 4 1: 3


sample input is=1259 and output is 500: 2 50: 5 10: 0 1: 9




Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. 

while True:

   y = (x + a/x) / 2.0

   if y == x:

     break

   x = y 


Hollow Rectangle - 2

Write a program to print a rectangle pattern of


M rows and N columns using the characters as shown below.Input

The first line of input is an integer


M. The second line of input is an integer N.Explanation

In the given example,

3 rows and 10 columns.Therefore, the output should be


+----------+

| |

| |

| |

+----------+


Sample Input 1

3

10

Sample Output 1

+----------+

| |

| |

| |

+----------+

Sample Input 2

5

10

Sample Output 2

+----------+

| |

| |

| |

| |

| |

+----------+





Half Pyramid - 4

Given an integer

N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.Input

The first line of input is an integer

N. The second line of input is an integer K.Explanation

In the example, the given starting number is

10, and the number of rows in the pyramid is 5.So, the output should be


24

23 22

21 20 19

18 17 16 15

14 13 12 11 10


Sample Input 1

10

5

Sample Output 1

24

23 22

21 20 19

18 17 16 15

14 13 12 11 10




LATEST TUTORIALS
APPROVED BY CLIENTS