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

Write a program that implements unit conversion for the following pairs: (1) lbs -> kg, (2) miles -> km and (3) Fahrenheit -> Celsius. Each conversion should be implemented using a function with has no return value. The main program will ask the user for a number to indicate which conversion they want to perform. Within the body of each of the function the user will then be prompted for the value to be converted. The result of the conversion should be displayed within the function.



Take user input and insert the data at the respective position in the sorted 1) stack 2) queue and 3) linked list.


Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters.Input


The input will be a single line containing a string.Output


The output should contain the sum and average of the numbers that appear in the string.

Note: Round the average value to two decimal places.Explanation


For example, if the given string is "I am 25 years and 10 months old", the numbers are 25, 10. Your code should print the sum of the numbers(35) and the average of the numbers(17.5) in the new line.




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

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 

Modify your program from the function above to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following:

  • How to format each dictionary item as a text string in the input file.
  • How to covert each input string into a dictionary item.
  • How to format each item of your inverted dictionary as a text string in the output file.

Create an input file with your original three-or-more items and add at least three new items, for a total of at least six items.

Include: 

  • The input file for your original dictionary (with at least six items)

Write an algorithm to read 100 numbers then display the largest.


Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post. 

Describe how you might deal with each error if you were writing a large production program. These descriptions should be general ideas in English, not actual Python code. 


SERIES OF OPERATIONS

myArray of numbers, write a JS program to perform the following steps and log the result.

Multiply each value with 9.

Subtract 20 from each value.

Multiply each value with 7.

Log the values of the resulting array separated by a space.

Input

The input will be a single line containing an array myArray

Output

The output should be a single line with values separated by a space

Constraints

Each value in the array must be a number

Sample Input

[ 12, 2, 2, 4, 1 ]

Sample Output

616 -14 -14 112 -77

"use strict";

process.stdin.resume();

process.stdin.on("data", (inputStdin) => {

  inputString += inputStdin;

});

process.stdin.on("end", (_) => {

  inputString = inputString.trim().split("\n").map((str) => str.trim());

  main();

});

function readLine() {

  return inputString[currentLine++];

}

function main() {

  const myArray = JSON.parse(readLine());

  /* Write your code here */

}


Write a C++ program for performing the following tasks with an array declared as

 int values[ROWS][COLUMNS];

where ROWS = 4 and COLUMNS = 5. Now perform the following tasks.

• Fill entries with a random number in the range 1 - 1000 inclusive. Remember to use rand() function, and the smallest value is 1 and the largest value is 1000.

• Compute the sum of all elements.

• Compute and print the average of all elements.

• Find and print the largest element in the array.

• Find and print the smallest element in the array

• Print the array elements in a table form with each line representing a row. Uset setw() manipulator with a width of 5 for each column. Remember, you are printing five columns in each row.


Lucky Pairs

Write Java script program to count the number of lucky pairs.

Two numbers are said to be lucky pairs . if first number is divided by second number and second number is divided by first number. given an integer N . find all possible combinations of lucky pairs.



input:

2


output:

2


Explanation:

input is 2

possible combinations are [1,2],[2,1].here in [1,2]1 is divisible by 2, and in [2,1] 2 is divisible by 1 .so the number of lucky pairs are 2.



LATEST TUTORIALS
APPROVED BY CLIENTS