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

Create a program in Python to accept input from a student and then display if the student is eligible to graduate and if so if they will graduate cum laude, magna cum laude or summa cum laude.  

Your program should prompt the student to enter his/her name and gpa. If the gpa is 4.0, then display a message stating that he/she has graduated summa cum laude. If the gpa is less than 4.0 but greater than or equal to 3.8, then display a message that they have graduated magna cum laude. If the gpa is not greater than or equal to 3.8 but greater than or equal to 3.5, then display a message that they have graduated cum laude. If the gpa is less than 3.5 but greater than 2.0, display a message that they have graduated. If the gpa is less than 2.0, display a message that they are not eligible to graduate but can take more courses to bring their gpa up to at least 2.0.


Write a program to print the given input word N times ina single line separated by space.

Number of digits until N

Given an integer N, write a program that prints the count of the total number of digits between 1 and N.

Input

The input is a positive integer.

Output

The output should be a single line containing the count of the digits up to the given number.

Explanation

Given

N = 10From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.

So the output should be 9 + 2 =

11.

Sample Input 1

10

Sample Output 1

11

Sample Input 2

4

Sample Output 2

4




Product of Numbers from M to N

Given two integers M, N. Write a program to print the product of numbers in the range M and N (inclusive of M and N).

Input

The first line of input is an integer M. The second line of input is an integer N.

Explanation

In the given example, the product of numbers between the range

2 and 5 is 2 * 3 * 4 * 5. Therefore, the output should be 120.

Sample Input 1

2

5

Sample Output 1

120

Sample Input 2

1

4

Sample Output 2

24




Sum of K powers

Write a program to print the sum of the Kth power of the first N natural numbers.

Input

The first line of input is an integer N. The second line of input is an integer K.

Explanation

In the given example, the sum of first

5 natural numbers power of 3.The sum should be 13 + 23 + 33 + 43 + 53

Therefore, the output should be

225.

Sample Input 1

5

3

Sample Output 1

225

Sample Input 2

2

8

Sample Output 2

257




Product of the Given Numbers

Given an integer N, write a program which reads N inputs and prints the product of the given input integers.

Input

The first line of input is a positive integer, N. The next N lines each contain an integer.

Output

The output should be the product of the given input integers.

Explanation

In the given example,

N = 3 and the input integers are 2, 3, and 7.So, the output should be 2 x 3 x 7 = 42.

Sample Input 1

3

2

3

7

Sample Output 1

42

Sample Input 2

4

11

2

4

9

Sample Output 2

792




Denominations - 4

Write a program to find the minimum number of notes required for the amount M. Available note denominations are 2000, 500, 200, 50, 20, 5, 2, 1.

Input

The first line is a single integer M.

Output

Print M in denominations.

Explanation

Given

M = 2257 Then 2257 can be written as

2000 * 1 + 500 * 0 + 200 * 1 + 50 * 1 + 20 * 0 + 5 * 1 + 2 * 1 + 1 * 0So the output should be

2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0.

Sample Input 1

2257

Sample Output 1

2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0

Sample Input 2

2345

Sample Output 2

2000:1 500:0 200:1 50:2 20:2 5:1 2:0 1:0




Rahul lives in City A and would like to travel to City B for work. There is a shuttle service for people in these cities which has a fixed schedule. The schedule for City A is a list of boarding times(at City A) and departure times(from City A) for each bus.


Note: No one is allowed to board a shuttle after the boarding time.


He arrives at time t and sometimes has to wait at the station. You are given a list of arrival times for n days.


Devise an algorithm to find him the shuttle with the least waiting time. (waiting time = boardingj - t , where j is the next shuttle. And boardingj >= t ) for each ti

If he also has access to the travel time of each shuttle. Can you help him find the shuttle which will help him reach his destination at the earliest ?

Return an array of shuttle indexes that Rahul took for n days.




pairs = [ (x,y) for x in range(5,1,-1) for y in range(4,1,-1) if (x+y)%3 == 0 ]





I was given 4 inputs 10,9,8,7
Here compare one by one
[10] here max 10
[10, 9] here max 10
[10, 9,8] here max 10
[10, 9,8,7] here max 10
So I want output as
10
10
10
10
LATEST TUTORIALS
APPROVED BY CLIENTS