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

A credit card company calculates a customer's "minimum payment" according to the following formula. The minimum payment is equal to either $10 or 19.9% of the customer's balance, whichever is greater; but if this exceeds the balance, then the minimum payment will be the balance. Write a program to print out the minimum payment using Python built-in functions min and max.

Example 1: If your balance is 1000, then your program should print "The minimum payment is 199".

Example 2: If your balance is 600, then your program should print "The minimum payment is 119.40".

Example 3: If your balance is 25, then your program should print "The minimum payment is 10".

Example 4: If your balance is 8, then your program should print "The minimum payment is 8".


smallest amoung three numbers input = 6,5, 4 and -1000, - 1000, -1000


Find the closest pairs (excluding self pairs) on the basis of both the distance


measures

b) Define the find_max_gap function which will take as a parameter a list of values, sort it in ascending order and return the largest difference between two consecutive values ​​in the list. Assume that the value list has at least two values ​​and that no function control is required for this. c) Define the present_list function that accepts a value list as an argument, and prints it as in the example: The random list is: 466.45, -59.27, -492.51, 410.98, 439.27 d) The program asks the user to enter the number n of the random values ​​that will be created, the range of values ​​(the user will give m), and the seed.


A program is asked to execute a text that is given as a multi-line string, and then returns statistics on the frequency of characters and word usage in the text based on the following specification. a) Create the auxiliary function capitalize_keep_only_en_chars (word) which accepts a word at the input and returns it in capital letters after ignoring characters other than the English alphabet (punctuation, etc.). For example, to enter "one--" return the word "ONE".

Assume that you have to create such an application for maintaining a database of book titles


and their costs.


Part 1: Write the script to create the required database and add data programmatically by


using the Insert query.


Part 2: Write a Python script connecting to the database created that has the following


features:


• A books table having the title, author, and price as fields.


• Accept input from the user for the title and quantity purchased by the customer.


• Fetch the price from the table by executing the Select query.


• Calculate the total amount and display it

Assume that you have to create a GUI-based form for the same books table that you created


in the module 5 assignment. The form should have the following features:


1. It should have the basic functionality and widgets displayed in the mock-up below:


2. It should fetch the price of the book when the 'find price' button is clicked.


3. The quantity field should only accept integer data.


4. When the 'find total amount' button is clicked, the field should display the total amount


by calculating the product of the price and quantity.


5. If the book title enter is not present in the database, a message saying the book is not


fond should be displayed

Calculate Euclidean distances between these pairs of points (total 10*10 = 100 pairs


including self pairs). This should give you a 10*10 2-D array where each value


corresponds to the distance between a pair.

Construct a 2-D 10 10 ∗ matrix with the following constraints:


• The element at [0,0] should be 1


• The element at [0,9] should be 100


• The element at [9,0]should be 50


• The interval between elements in rows should be constant


• The interval between elements in columns should be constant

Find latitude and longitude of first 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset(https://cdn.jsdelivr.net/gh/apilayer/restcountries@3dc0fb110cd97bce9ddf27b3e8e1f7fbe115dc3c/src/main/resources/countriesV2.json).





Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.





Assume radius of earth: 6371 km



Round length of each line and final result to 2 decimal points



If co-ordinates are missing for any country use 0.000 N 0.000 E





Population limit: 65847





Note: Population limit will change at random intervals. So please make sure answer is computed for the correct population limit

LATEST TUTORIALS
APPROVED BY CLIENTS