Python Answers

Questions answered by 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

Lowest and Highest score

The teacher gave out the scores of the science quiz conducted last week and asked the ones with the lowest and highest scores to group up. Print the names of the students with minimum and maximum scores, respectively.

Note: In case of a tie, choose the name which comes first in the (dictionary order).


Sample Input1

2

shakti 24

disha 26

Sample Output1

shakti disha


Sample Input2

3

ajay 23

bijay 24

sanjay 23

Sample Output2

ajay bijay



arun is in a class with N students he knows the height of each student in the class. he then tries to answer Q queries. in each query, he is given an integer X and he has to find the number of students in the class who have a height of at least X

I/p: the 1st line of input two space separated integers N & Q. The second line of input contains N space separated integers, the height of the N students in the class. each of the next Q lines contain one single integer X.

output: the output consists of Q lines where each line contains the answer of J th query (1<=j<=0)

I/p: 3 1

100 160 130

120

O/p: 2

input: 5 5

1 2 3 4 5

6

5

4

3

2

output:


1

2

3

4


a class of students p gave a science viva their final results are listed out in the order of their roll numbers in the list s the teacher asked the students to note the number of students who gave the viva after them and got less score than them write a program to get the final list from the students in the roll number order

I/p: the 1st line contains a single integer N that represent the no.of students in class. the 2nd line contains N space separated integers representing the scores of the students in the order of their roll no.s

O/p: the output should contain N space separated integers representing the count of students as mentioned above

Input : 3

13 12 11

output: 2 1 0

input: 4

4 3 5 2

output:

2 1 1 0


Sum of Non-Diagonals

Write a program to print the following,


Sample Input1

3

9 8 7

6 5 4

3 2 1

Sample Output1

20


Cards Game

Write a program to print the following,


Input

The only line of input contains three space separated integers M,N and Z.


Output

Print the number representing the person who will get the last card.


Explanation

Given M=3, N=3, and Z=2.

Distribution of cards starts from 2.The final order of persons is 2,3,1.

The last person to get the card is 1.


Sample Input1

3 3 2

Sample Output1

1



Difficult Addition


Arjun is trying to add two numbers. Since he has learned addition recently, an addition which requires a carry is difficult for him. Your task is to print Easy if the addition does not involve a carry, Otherwise print Hard.


Input

The first line of input contains two space separated integers A and B.


Output

If the addition does not involve a carry,print Easy, otherwise print Hard.


Explanation

When calculating 229 + 390, we have a carry from the tens digit to the hundreds digit, so the answer is Hard.


Sample Input1

229 390

Sample Output1

Hard


Sample Input2

123456789 9876543218

Sample Output2

Easy



Number Game


A group of people are playing a game.They are standing and each carring a card with a number on it.These numbers in the list A. A random number S is selected.


Find out the new list of numbers after

  • S people were removed from the left.
  • S people were removed from the right.


Sample Input1

1,2,3

1

Sample Output1

2 3

1 2


Math Quiz


Write a program to print the following,


Sample Input 1

1 3 4 5 6

5

3 5

Sample Output1

12


String Concatenation


Disha has three strings A, B, and C consisting of lowercase letters.She also has a string T consisting only of characters 1, 2 and 3.

She wants to concatenate the three strings according to the characters in T.

Your task is to print the final output string.


Note: Formally, follow the below instructions:

* For each integer i such that 1<=i<=|T|, let the string si be defined as follows:

  • A if Ti = 1.
  • B if Ti = 2.
  • C if Ti = 3.

*Concatenate the strings s1,s2,...,s|T| in this order and print the resulting string.


Sample Input1

mari

to

zzo

1321


Sample Output1

marizzotomari


Find the Password

Joey is playing escape room and to exit the room he has to find the password for the final door.To know the password he is given a sentence G and told to rearrange the sentence by rotating its W words in the right.Can you help joey find the password?


Input

The first line of input is a string G.

The second line of input is an integer W.


Output

The output is a string contains a sentence got by the rearrangement as per above mentioned criteria.


Explanation

In the above example, the sentence is Raju is going to school and W is 3.

Shift the three words in the right,which means the last three words will be moved to the front.

So, the output should be going to school Raju is


Sample Input1

Raju is going to school

3

Sample Output1

going to school Raju is


LATEST TUTORIALS
APPROVED BY CLIENTS