Questions: 5 290

Answers by our Experts: 5 288

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

Sum of prime numbers in the input

def mystery1(x):
    return x + 2

def mystery2(a, b = 7):
    return a + b

#MAIN
n = int(input("Enter a number:"))
ans = mystery1(n) * 2 + mystery2 (n * 3)
print(ans)

What is output when the user enters -4?





Tournament Training:

To prepare for the upcoming marthon.Ramesh trains one long distancerun each saturday .He considers a saturday to be a progress day if he runs more kilometers thsn the previous saturday Ramesh wants to track the no.of progress day

Given the no.of kilometer run by rsmesh on each aturday print the total no.of progress days

The 1st line of input contains space-seperated integers

i/p:

12 11 10 12 11 13

o/p:2

i/p:1 2 1 1 1

o/p:1


Number of moves:


you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.


explanation: given N=6 K=2


bishop position 5 2


obstacle positions (2 2), (1 5)


the bishop can move in so o/p is 6


I/p:


6 2


5 2


2 2


1 6


O/p:


6


I/p:


6 4


3 3


1 3


3 1


5 1


1 5


O/p: 7

Dice Score:

two friends are playing a dice game, the game is played with five six-sided dice. scores for each type of throws are mentioned below.

three 1's = 1000 points

three 6's = 600

three 5's = 500

three 4's = 400

three 3's = 300

three 2's = 200

one 1 = 100

one 5 = 50

I/p: 2

1 1 1 1 1

6 6 6 1 5

O/p: 1200

750

I/p: 2

2 1 5 2 2

1 1 1 2 2

O/p: 350

1000



Pager:

Imagine a paper with only one button. for the letter "A", you press the button one time, for "B", you press it 2 times for "E", you press it five times. for "G", it's pressed seven times, etc.

Given a string s, print the total number of times the button should be pressed

explanation: given string is abde. then the total no. of times the button pressed is 1+2+4+5=12

I/p: abde

O/p: 12

I/p: xyz

O/p: 75


given a matrix of M rows & N columns, you need to find the smallest number in each row & print the sum of the smallest numbers from all rows.

explanation: M=3. given matrix is

1 2 3

4 5 6

7 8 9

the minimum elements of each row 1, 4, 7 => sum is 1+4+7=12

I/p: 3 3

1 2 3

4 5 6

7 8 9

O/p: 12

I/p: 2 3

0 12 -13

-10 0 10

O/p: -23


m rows, n columns:



input:

3,3


output:

1 2 3

4 5 6

7 8 9


validation:


username should be in between 4 and 25

should start with letters but not underscore

should not be special characters


input:

google

output:

true


input:

google@123

output:

false


pager:


input:

abde(1+2+4+5)

output:

12


input:

XYZ

output:

75


LATEST TUTORIALS
APPROVED BY CLIENTS