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 Python program (using any of the selection structures) that will accept distance in kilometer/s as input, and student or elderly passengers will pay the discounted rate, disabled passengers will get an additional 10% discount with the original discounted rate, otherwise the regular fare will be used as basis for the computation of fare. The output will be the total fare for the passenger.



Start price for :


regular passenger - 9.00


Student/ Elderly/ Disabled- 6.20



Sample output:



Enter Distance in Kilometer/s: 12


Regular/ Student/ Elderly/ Disabled: Disabled



Total Fare: 14.175

Input: 5 0 2 1 3 2 1 4 7 Expected Output: 7x^4 + 6x^3 + x^2 + 3x + 2 What I got with the above code is : 7x^4 + 6x^3 + 1x^2 + 3 + 2


Then how to replace the 1x^2=x^2

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


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

123456789 9876543218

Sample Output1

Easy


Sample Input2

229 390

Sample Output2

Hard


Note: You can run the both test cases and post the screenshot of the Passed test cases.


Write a python function Write_String(fanme, *list) which take a list containing string elements and write them in a file myfile.txt until the string “finish” (not case sensitive) occur. The function then returns the contents written in file as a string. Before writing list elements in file, you also need to make a separate python function to check whether input list contains "Finish" or not. If not, then it should return error as shown in example.

myfile.txt:

Python

Java

C

C++

Ruby

.Net 

Example-1

Example-2

Example-3

Input:

myfile.txt

["Python", "Java", "C", "C++", "Finish"]

 

Output:

PythonJavaCC++

 

Input:

myfile.txt

["Python", "Java", "C", "C++", "Finish",".Net", "Rubby"]

 

Output:

PythonJavaCC++Input:

myfile.txt

["Python", "Java", "C", "C++"]

 

Output:


Error: List does not contain Finish

 


Write a python function Read_Prime(fname, list)  which takes a list of numbers as an input, use this number to write them in a file "primes.txt" . The function then read the file and return a list containing only prime numbers as shown in the example. Also, write the exception handling code to show the proper message.


 

Example-1

Example-2

Example-2

Input:

primes.txt

[1,2,3,4,5,6,7]

 

Output:

[1,2,3,5,7]

Input:

primes.txt

[3,6,5,13,18,21]

 

Output:

[3,5,13]

Input:

primes.txt

[2,4,6,8,10]

 

Output:

[2]



In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all the nonnegative integers from 1 to n. For example:


7! = 1 x 2 x 3 x 4 x 5 x 6 x 7 = 5,040


Write a program that lets the user enter a nonnegative integer and then uses a loop to calculate the factorial of that number. Print the factorial to standard output.


Sample Run

Enter a nonnegative integer:7↵ 

5040↵


At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase by percent each year for the next 5 years. Write a program with a loop that displays the projected semester tuition amount for the next 5 years. 


The program should print out the result in the form


In 1 year, the tuition will be $8002.3.

In 2 years, the tuition will be $8103.2.

In 3 years, …

In 4 years, …

In 5 years, …


(If, for example, the tuition would cost 8002.3dollars in one year, etc.)


Sample Run


In 1 year, the tuition will be $8240.0.↵ 

In 2 years, the tuition will be $8487.2.↵ 

In 3 years, the tuition will be $8741.816.↵ 

In 4 years, the tuition will be $9004.07048.↵ 

In 5 years, the tuition will be $9274.192594400001.↵


use sort() function to sort [34,1,2,6,3,7], [[1,3], [3,2], [1,2], [3,1]] and ['a', 'x', 'e', 'A', 'X', 'E'] and tell us what you observe in 2nd, 3rd list"





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


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS