CIS 41A Unit A, Problem A

Numeric operations

Write a script to perform various basic math operations. Use some functions imported from Python's math module. Generate formatted output.

At the top of your script, put the following multi-line comment with your information:

'''
Your name as registered, with optional nickname in parentheses
CIS 41A   Fall 2021
Unit A, Problem A
'''

Basic numeric operations

1) Calculate and print the final value of each variable.

  1. a equals 3 to the power of 2.5
  2. b equals 2
    b equals b + 3 (use +=)
  3. c equals 12
    c = c divided by 4 (use /=)
  4. d equals the remainder of 5 divided by 3

Built-in functions abs, round, and min

2) Use abs, round, and min to calculate some values. These are all Python built in functions (see: BIF).

  1. Print the absolute difference between 5 and 7 (the answer should always be a positive number).
  2. Print 3.14159 rounded to 4 decimal places.
  3. Print 186282 rounded to the nearest hundred.
  4. Print the minimum of 6, -9, -3, 0

Functions from the math module

3) Use some functions from Pythons math module to perform some calculations. (see: Mathematical functions).

  1. Ask the user for a number (test with the value 7.6).
  2. Print the square root of the number, rounded to two decimal places (include an appropriate description).
  3. Print the base-10 log of the number, rounded to two decimal places (include an appropriate description)
    (see https://docs.python.org/3/library/math.html).

Add the following at the end of the script to show your results:

'''
Execution results:
paste execution results here
'''

Submit your finished py script in Canvas, Problem A.