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

Minimal Absolute Difference

There are N pyramids in a line.You are given their heights as a list of integers.Write a program to find the minimum absolute difference between the heights of any two different pyramids.


Input

The input is a single line containing space-separated integers.


Output

The output should be a single line containing the minimum absolute difference of any two different pyramid heights.


Explanation

Given Pyramid heights are 7 1 5.

The absolute difference between the heights of any two different pyramids are


write a program (wap)to print the largestof threenumbers

Pattern

A teacher asked Ramesh to draw a Quadrilateral of a specific pattern with only symbol. The length and height should be L. Here L is the number of characters in every line. The height of the

*

quadrilateral is the number of lines it contains.

The slope of the quadrilateral taken as S represents the the number of extra space characters in a line when compared to its next line.

The last line will not have any space characters before the character.


Sample Input

6

9

Sample Output1

******

******

******

******

******

******



Find latitude and longitude of first 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset ( https://cdn.jsdelivr.net/gh/apilayer/restcountries@3dc0fb110cd97bce9ddf27b3e8e1f7fbe115dc3c/src/main/resources/countriesV2.json ).

Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.

  • Assume radius of earth: 6371 km
  • Round length of each line and final result to 2 decimal points
  • If co-ordinates are missing for any country use 0.000 N 0.000 E

Population limit: 11750

Matrix Problem

you are given an m*n matrix.write a program to compute the perimeter of the matrix and print the result.Perimeter of a matrix is defined as the sum of all elements of the four edges of the matrix.


Input

The first line of input containing the positive integer.

The second line of input containing the positive integer.

The next N lines of input space-separated integers.



Explanation: The input should be

3

4

1 2 3 4

5 6 7 8

9 10 11 12


The output should be 1+2+3+4+8+12+11+10+9+5 = 65


Sample Input1

4

4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16


Sample Output1

1+2+3+4+8+12+16+15+14+13+9+5=102



Minimal Absolute Difference

There are N pyramids in a line.You are given their heights as a list of integers.Write a program to find the minimum absolute difference between the heights of any two different pyramids.


Input

The input is a single line containing space-separated integers.


Output

The output should be a single line containing the minimum absolute difference of any two different pyramid heights.


Explanation

Given Pyramid heights are 7 1 5.

The absolute difference between the heights of any two different pyramids are




A teacher asked Ramesh to draw a Quadrilateral of a specific pattern with only symbol. The length and height should be L. Here L is the number of characters in every line. The height of the

*

quadrilateral is the number of lines it contains.

The slope of the quadrilateral taken as S represents the the number of extra space characters in a line when compared to its next line.

The last line will not have any space characters before the character.


Sample Input

6

9

Sample Output1

******

******

******

******

******

******


Frequency of Numbers


Develop a Python application that will randomly select n integers from 1 to 9 and will count the number of occurrence of the numbers without using the Counter from collections library.


Sample Output:


How many numbers?: 7


[2, 6, 8, 2, 1, 1,6]


2-2


2-6


1-8


2-1

Simple Dice Game


Develop a Python application that will simulate a simple dice game by rolling two dice for the player as his bet followed by another roll of the two dice for the computer.


The mechanics is as follows:


1. If after the roll of the two dice, resulted to same number then the sum will be doubled.


2. If the value of each dice is different, then just get the sum of the values of each dice.


Who gets the highest value wins the game.

10.Subtract every elements in 2D array a2d with 1d array b1d, such that the first row’s elements of a2d subtracts the first element of b1d, the second row’s elements of a2d subtract the second element of b1d and the third row’s elements of a2d subtract the third element of b1d.


a2d = np.array([[10,10,10],[11,11,11],[12,12,12]])

b1d = np.array([2,3,4])


Answer:


Output:

array([[8, 8, 8],

       [8, 8, 8],

       [8, 8, 8]])


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS