ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

Write a main function that will print your namE

USE PYTHON 3 ONLY

 

1.  Write a main function that will print your name.  Call the main function.

2.  You are creating a function called compute_discount which takes a float as the cost and a Boolean value to indicate membership.  If the customer is a member, give him/her a 10% discount.  If the customer is not a member, she/he will not receive a discount.  Give all customers a 5% discount, since it is Cyber Tuesday.  Return the discounted cost.  Call the function from within main() and pass in 150.78 and True.  Call the function from within main() and pass in 98.23 and False.  Print out the discounted cost with two decimal places of precision.

3.  You are buying a calling card, write a function named phone_card.  Pass in the value of the phone card to be purchased as an integer.  If you buy a $10 or $20 card, you will pay 0.10 dollars per minute.  If you buy a $50 or $100 card, you will pay 0.08 dollars per minute and receive $5.00 extra of phone time at the 0.08 dollars per rate.  Compute and return the number of minutes. Call the function from within main() and pass in 100.  Call the function from within main() and pass in 20.  Print out the number of minutes you will have purchased.

4.  Create a function named multi_comp which takes in two floating point parameters value_one and value_two.  Compute and return three values:  the product of these two values, the sum of these two values, and the value of value_one raised to the power of value_two.   Call the function from within main() and pass in 5 and -2. Print out the three returned values.  Call the function from within main() and pass in 3 and 4. Print out the three returned values.

5.  Create a function named compute_balance which takes two floating point parameters.  Pass in the current_balance and the payment as floating point values.  Set a default value for the current_balance to 1000 and the default value for the payment to 20.  Subtract the payment from the current_balance.  If the current_balance is greater than 0, return a string which has "balance owed" and return current_balance.  If the current_balance is less than 0, return "credit" and return current_balance as a credit (make this value positive).   If the current_balance after the payment is 0, return "paid in full" and 0.  Call the function from within main() and pass in 500 for the current_balance. Print out the two returned values.  Call the function from within main() and pass in 1100 for the payment. Print out the two returned values. Call the function from within main() and pass 1000 for the payment. Print out the two returned values.

6.  Create a function named find_sum which will take in two integer parameters lower_param and upper_param.  Compute the sum of all of the numbers from lower_param to upper_param.  Return the sum.  Call the function from within main() and pass in 5 and 10.  Print out the returned sum.

7.  Create a sense = SenseHat() object in main().

8.  Create a function draw_pattern that takes in four parameters- x1,y1,x2,y2- as integers and one parameter, s, as a SenseHat object.  Draw two blue pixels at the locations specified in the coordinates x1,y1 and x2,y2. Call the function from within main() and pass in 4,5,7,2 and the sense object.

9.  Create a function named data_center_monitor which takes in six parameters.  A minimum temperature, maximum temperature, minimum humidity, maximum humidity as floats, email address as a string, s, as a SenseHat object.  Continue to monitor the temperature and pressure from the SenseHat with a while loop.  Allow a KeyboardInterrupt to exit.  If the temperature or humidity are not in the correct range, send an email.  Specify a sleep time of one second between monitoring these environmental variables.  Please only send one email in this testing environment.

Call the function from within main() and pass in 70,90,40,55, your email address, and the sense object.  The lower and upper temperatures are in Fahrenheit.  These values are considered typically operation ranges for a Data Center.

(BONUS)

Create a function named roll_dice that will call the randint function twice to generate two random numbers between 1 and 6.  Calculate the sum of the two random numbers.  If the sum is 7, print "You win!" and return the sum.  Otherwise, print "Roll again" and the return the sum.

Call the function roll_dice from the main() function. Write a loop which will continue until the sum is 7.

 

 

Answers

(11)
Status NEW Posted 02 May 2017 03:05 AM My Price 9.00

-----------

Not Rated(0)