08 Jun Bigger.py: Write a function getBiggerNumber(x, y) that takes
Question
Create Python programs to do the following (the names of the programs that you should save them as precede the program specification):
1.Bigger.py: Write a function getBiggerNumber(x, y) that takes in two numbers as arguments and returns the bigger number. Use the function in a script with two examples to show that it works.
Examples
getBiggerNumber(20, -10)
20
getBiggerNumber(10, 10)
10
2.Hypotenuse.py:The Pythagorean Theorem for a right-angle triangle can be written as, where a and b are sides of the right angle and c is the hypotenuse. Write a function to compute the hypotenuse given sides a and b of the triangle. Use the function in a script with two examples to show that it works.
Examples
hypotenuse(3, 4)
5
hypotenuse(5, 12)
13
# Hint: You can use math.sqrt(x) to compute the square root of x by using the import math module.
3.FirstandLast.py:Define a function calls addFirstAndLast(x) that takes in a list of numbers and returns the sum of the first and last numbers. Use the function in a script with two examples to show that it works.
Examples
addFirstAndLast([])
0
addFirstAndLast([2, 7, 3])
5
addFirstAndLast([10])
10
4. Listdict.py: Asks the user for two lists, one with letters and the second with the number of the letter (i.e. A is 1, B is 2, C is 3, etc.), then creates the following dictionary: the values are the letters in the list, with the corresponding key being the number in the list.
5. Dict2.py: Create the following dictionaries:
states = {‘Oregon’: ‘OR’, ‘Florida’: ‘FL’, ‘California’: ‘CA’, York’: ‘NY’, ‘Michigan’: ‘MI’}
cities = {‘CA’: ‘San Francisco’, ‘MI’: ‘Detroit’, ‘FL’: ‘Jacksonville’}
First print out each dictionary, then add ‘New York’ to the dictionary cities with the key ‘NY’ and then add ‘Portland’ to the same dictionary with the key ‘OR’.
Then print out the following, using a print statement and the two new keys you just added:
NY state has: New York
OR state has: Portland
Then print out the following, using a print statement and the appropriate keys from the states dictionary:
Michigan’s abbreviation is: MI
Florida’s abbreviation is: FL
Finally, using a print statement and a combination of the two dictionaries, print out the following:
Michigan has: Detroit
Florida has: Jacksonville
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.