CMPS 5P Introduction to Programming in Python Programming Assignment 1 solved

$35.00

Category:

Description

5/5 - (1 vote)

In this assignment, you will write a Python program that computes the volume and surface area of a sphere
whose radius is entered by the user. If you don’t know the formulas for spherical volume and surface area,
you can find them at:
http://math.about.com/od/formulas/ss/surfaceareavol.htm
Emulate the examples Rectangle.py, Circle.py, and Box.py posted in the Examples section of the
course webpage. Call your Python script Sphere.py. A sample session with the program appears below.
$ python Sphere.py
Enter the radius of the sphere: 2.3
The volume is: 50.965010421636
The surface area is: 66.47610054996001
$
Format your input and output so that your program reproduces the above session exactly, even down to
capitalization, punctuation and spacing.
Every program you submit in this class (including this one) should begin with a comment block resembling
the model below.
# your name
# your userid@ucsc.edu
# programming assignment 1
# a short (one or two sentence) description of what the program does
Test your program thoroughly, verifying the results by hand if necessary. Transfer the file Sphere.py to
the Unix timeshare, then submit it to the assignment name pa1. If you don’t know how to logon to the
timeshare, or submit an assignment, see the Practice Assignment for instructions.