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

Problem Description :

The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i

Note:

Return -1 if the array is null
Return 0 if the total amount of food from all houses is not sufficient for all the rats.
Computed values lie within the integer range.
Example:

Input:

r: 7
unit: 2
n: 8
arr: 2 8 3 5 7 4 1 2
given a number of mangoes and number of persons. Find the number of ways to distribute identical mangoes among identical persons in python

Write a program to create a menu-driven calculator that performs arithmetic operations (+, -, *, /, and %).

The input will be a single line containing 2 integers and operator(+, -, *, /, and %) similar to 3 + 5.

If given operator is "+", print sum of two numbers.

"-", print subtraction of the two numbers.

"*", print multiplication of the two numbers.

"/", print division of the two numbers.

"%", print modulus operation of the two numbers.

Explanation

For EX, if the operator is "+" and two numbers are 3 and 5. As it is addition, your code should print the sum of two numbers (3 + 5), which is 8. Similarly, if it is "*" and two numbers are 2 and 5.

As it is a multiplication, your code should print result of multiplication of 2 numbers (2 * 5), which is 10.

Similarly, if operator is "-" & two numbers are 10 and 9.As it is subtraction operator, your code should print result of subtraction of 2 numbers (10 - 9), which is 1.





Prefix Suffix

Write a program to check the overlapping of one string's suffix with the prefix of another string.Input


The first line of the input will contain a string A.

The second line of the input will contain a string B.Output


The output should contain overlapping word if present else print "No overlapping".Explanation


For example, if the given two strings, A and B, are "ramisgood" "goodforall"

The output should be "good" as good overlaps as a suffix of the first string and prefix of next.

Sample Input 1

ramisgood

goodforall

Sample Output 1

good

Sample Input 2

finally

restforall

Sample Output 2

No overlapping




Word Count

Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.Input


The input will be a single line containing a sentence S.Output


The output contains multiple lines, with each line containing a word and its count separated by ": " with the order of appearance in the given sentence.Explanation


For example, if the given sentence is "Hello world, welcome to python world", the output should be

Hello: 1

world: 2

welcome: 1

to: 1

python: 1

Sample Input 1

Hello world welcome to python world

Sample Output 1

Hello: 1

world: 2

welcome: 1

to: 1

python: 1

Sample Input 2

This is my book

Sample Output 2

This: 1

is: 1

my: 1

book: 1




Write a program to display a customized message based on temperature T


input1 input2

-50.5 5.7


output output

Freezing weather Very Cold weather


Rearrange Numbers in String

In this Python question they were given sample input and output when i did code for this question the sample input and output were came but they had some hidden test cases that hidden test cases are getting failed please give me the code related to question


The above Url contains Rearrange Numbers in String Question and explanation and sample input and output

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


The above Url contains the code of Rearrange Numbers in String that i was tried

https://drive.google.com/file/d/14Lmk0_M7dKQuCdWDnFYKssJPZom4bldD/view?usp=sharing


Trapezium Order


You are given an integer N Print N rows starting from 1 in

the trapezium order as shown in the output of the below examples.


Input

The input contains an integer N.

Output

The output should have N lines.

Each of the N lines should have space-separated stegers as per the trapezium order.


Sample Input 1

4

Sample Output 1

1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11

see correct need exact pyramid,with give any input number..

Write a Python program to create an array of 10 integers and display the array items. The array should be populated with random integers from 10 to 50 . The program should also display separately all the even number within the array.


Diamond

Given an integer value

N, write a program to print a number diamond of 2*N -1 rows as shown below.Input

The first line of input is an integer

N.Explanation

In the given example, the number of rows in the diamond is

5.So, the output should be


. . . . 0 . . . .

. . . 0 0 0 . . .

. . 0 0 0 0 0 . .

. 0 0 0 0 0 0 0 .

0 0 0 0 0 0 0 0 0

. 0 0 0 0 0 0 0 .

. . 0 0 0 0 0 . .

. . . 0 0 0 . . .

. . . . 0 . . . .


Sample Input 1

5

Sample Output 1

. . . . 0 . . . .

. . . 0 0 0 . . .

. . 0 0 0 0 0 . .

. 0 0 0 0 0 0 0 .

0 0 0 0 0 0 0 0 0

. 0 0 0 0 0 0 0 .

. . 0 0 0 0 0 . .

. . . 0 0 0 . . .

. . . . 0 . . . .

Sample Input 2

4

Sample Output 2

. . . 0 . . .

. . 0 0 0 . .

. 0 0 0 0 0 .

0 0 0 0 0 0 0

. 0 0 0 0 0 .

. . 0 0 0 . .

. . . 0 . . .




LATEST TUTORIALS
APPROVED BY CLIENTS