Hello world: expressions and variables

Hello world: expressions and variables

Problem 1 – multiply.py: Multiplication [5 points] Write a program that takes two floating point values x and y from the command line and prints their product.

Problem 2 – distance.py: Euclidean distance [5 points] Write a program that takes two floating point values x and y as command-line arguments and prints the distance of the point (x, y) from the origin (0, 0). Use math.sqrt().

Problem 3 – order_check.py: Order checking [20 points] Write a program that takes three double values x, y, and z as command-line arguments and prints True if the values are strictly ascending or descending (i.e., x < y < z or x > y > z), and False otherwise.

Problem 4 – biased_flip.py: Biased coin flip [20 points] Write a program that takes one floating point argument p and prints out at random either True with probability equal to p, or False with probability equal to 1 − p. Note that a fair coin would correspond to the input p = 0.5. Use random.random() in your solution

see attachment for details

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper