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

print 9 number with help of "*"


Create a Python script which will accept two positive integers where the first number would be the start of a range and the second number would be the end of a range. Then the application will determine the sum of all EVEN numbers and sum of all ODD numbers from the given range.


Sample Output:

Start of a Range: 5

End of a Range: 10

Sum of Even nos. is 24

Sum of Odd nos. is 21


I need the code to have an output stated above.


Write a python function that accepts a list of numbers and try to find out the value of a ‘magic index’. The ‘magic index’ is calculated as the ratio of the largest and smallest list element. The python function Magic_Index(A) (Refer RollNo_W10B_1.py)Take a list of elements and return the value of the magic index or error message for any possible exceptions. The error message will be "error occurred = error name".

Given a string in camel case, write a python program to convert the given string from camel case to snake case

Write a python program that prints a rectangle of size M (height/line numbers) and N (length/column numbers) using incrementing numbers where M and N will be given as input. Please look at the examples below for clarification.



How do I remove the extra "And" when I input 2 and 3 flavors? When I input, "Chocolate Vanilla" I don't get extra "And" but when I include, "Chocolate and Vanilla", I get the extra "And". 


Example: You have selected Chocolate and Vanilla flavors!

My Incorrect Output: You have selected Chocolate And and Vanilla flavors!


order = input("\n" + first_name.capitalize() + "," " " + "Which flavors would you like on your icecream today?\n\n" +
              "\n".join(["Chocolate", "Vanilla", "Strawberry"]) + "\n\n")

order = order.lower().split()
plural = "s" + "!" if len(order) > 1 else "" "!"
union = " and " if len(order) > 1 else ""
print("\nYou have selected" + " " + ", " .join(order[:-1]).title() + union + order[-1].title() + " " + "flavor" + plural)

Number Arrangement

write a program to re-arrange all the numbers appearing in the string in decreasing order.


Note: There will not be any negative numbers or numbers with decimal part.


Input

The input is a string containing the actual sentence.


Output

The output is a string containing the modified sentence as mentioned above.


Explanation

For example, if the actual sentence is It is a 3days 4nights holiday trip.

The numbers in the sentence are 3 and 4.After arranging them in the decreasing order, the output looks like It is a 4days 3nights holiday trip.


Sample Input1

It is a 3days 4nights holiday trip

Sample Output1

It is a 4days 3nights holiday trip



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