Question
Volume of a Cube Type a program that computes volume V of a cube with sides of length L = 4cm and prints the result
Volume of a Cube
Type a program that computes volume V of a cube with sides of length L = 4cm and prints the result to the screen. Both V and L should be defined as separate variables in the program.
Question 2: Area and Circumference of a Circle
Type a program that computes both the circumference C and the area A of a circle with radius r = 2 cm. The variables C, A and r should all be defined as separate variables in the program.
Question 3: Volumes of Three Cubes
We are interested in the volume V of a cube with length L: V = L3, computed for three different values of L. a) In a program, use the np.array function to compute and print three values of L, equally spaced on the interval [1, 3]. b) Carry out, by hand, the computation V = L3 when L is an array with three elements. That is, compute V for each value of L. c) Modify the program in a), so that it prints out the result V of V = L**3 when L is an array with three elements as computed by np.array. Compare the resulting volumes with your hand calculations.
Question 4: Array Data
Assume four members of a family with heights 1.60 m, 1.85 m, 1.75 m, and 1.80 m. Their weights are 100 kg, 120 kg, 80 kg, 75 kg, respectively. Using the BMI formula, BMI = weight (kg) / [height (m)]2, to calculate their BMI index. Use np.array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
First make sure you have NumPy installed for the third and fourth questions as NumPy is used for arr...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started