Python Programming: An Introduction to Computer Science
3rd Edition
ISBN: 9781590282779
Author: John Zelle
Publisher: Franklin Beedle & Associates
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 3, Problem 1PE
Program Plan Intro
Calculate volume and area of sphere
- Define the main function.
- Assign the value of “PI” to the variable.
- Get the value of radius and store it in a variable “radius”.
- Calculate volume and area by using the given formula.
- Display the volume and area of the sphere.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A-Write a program to compute the drag force F, (in Newton) When a body swims through fluid,
the drag force is given by
1
F₁ =pV²ACD
Take:
p= 1000 kg/m3 is the density of fluid,
V 1.25 (m/s) is the swimming speed,
A=0.25 m² is the frontal area of the body,
Cp=0.09 is the coefficient of drag.
Matlap
Python
Write a program to calculate the position of a projectile at a given time t. For an
initial velocity vo and angle of departure ®g, the position is given by x and y
coordinates as follows (note: the gravity constant g is 9.81 m/s²):
X= V0 Cos (0)t
y=vo sin (8,)t –; gt
The program should initialize the variables for the initial velocity, time, and
angle of departure. It should then call a function to find the x and y coordinates,
and then another function to print the results
Chapter 3 Solutions
Python Programming: An Introduction to Computer Science
Ch. 3 - Prob. 1TFCh. 3 - Prob. 2TFCh. 3 - Prob. 3TFCh. 3 - Prob. 4TFCh. 3 - Prob. 5TFCh. 3 - Prob. 6TFCh. 3 - Prob. 7TFCh. 3 - Prob. 8TFCh. 3 - Prob. 9TFCh. 3 - Prob. 10TF
Ch. 3 - Prob. 1MCCh. 3 - Prob. 2MCCh. 3 - Prob. 3MCCh. 3 - Prob. 4MCCh. 3 - Prob. 5MCCh. 3 - Prob. 6MCCh. 3 - Prob. 7MCCh. 3 - Prob. 8MCCh. 3 - Prob. 9MCCh. 3 - Prob. 10MCCh. 3 - Prob. 1DCh. 3 - Prob. 3DCh. 3 - Prob. 4DCh. 3 - Prob. 6DCh. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 3PECh. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Prob. 7PECh. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Prob. 10PECh. 3 - Prob. 11PECh. 3 - Prob. 12PECh. 3 - Prob. 13PECh. 3 - Prob. 14PECh. 3 - Prob. 15PECh. 3 - Prob. 16PECh. 3 - Prob. 17PE
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- With vicual basicarrow_forward(General math) The value of p can be approximated by this series: 4(113+1517+....) Using this formula, write a program that calculates and displays the value of , using 2, 3, and 4 terms of the series.arrow_forward(Program) Write a program to simulate the rolling of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with theexpressiondots=(int)(6.0randomnumber+1), where random number is between 0 and 1.)arrow_forward
- Airline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönderarrow_forwardwrite a program to calculate the weight of cylinder using given formulaarrow_forwardA pendulum is simply a weight attached to a fixed point, usually through a string or a rod, and it swings freely backward and forward. The period of a pendulum is the amount of time that it takes to go from one point to another as it swings. Length of pendulum SWING T = PERIOD of the swing The formula to compute the period (7) is the following: T = 2π g=9.8 m/sec² L is the arm length of pendulum in meters. The unit of the period (7) is seconds. Write a program that will generate a table that will show the period (7) for several pendulums with lengths (L) in the range 10cm ≤L≤ 100cm in increments of 2cm. Your code must: 1) include a user-define function that performs a single period calculation, use the following function prototype: void pendulumPeriod(float length, float *period) 2) display to the monitor the length and period of the pendulums in table format with a header and units. 3) save the lengths and period of the pendulums to a file.arrow_forward
- program that takes an integer as the number of minutes and outputs the total hours and minutes (90 minutes = 1 hour 30 minutes).arrow_forwardDuring the past decade ocean levels have been rising faster than in the past, an average of approximately 3.1 millimeters per year. Write a program that computes how much ocean levels are expected to rise during the next 20 years if they continue rising at this rate. Display the answer in both centimeters and inches.arrow_forwardWrite a program to calculate and print the distance between two points(4,3) and (6,2)arrow_forward
- Given an airplane's acceleration and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula. length=v^2/2*a. write a program that prompts the user to enter V in meters and acceleration an in meter/second and display the minimum runway length.arrow_forwardDevelop a program to calculate the height of a building. To measure how tall the building is you go to the top floor and let a stone fall to the ground, while measuring the time it takes to reach the ground. To increase the precision of the calculations the experiment is conducted a number of times. The user should input how many times he conducted the test and input the time (t) for each test. Calculate the height h given the equation h= ½ (g * t ³) where t is the time and g= 9.81 m/s (this is a constant). The program should print out the height expressed in meters.arrow_forwardPoints on a two-dimensional plane are specified uniquely using two numbers, the point’s distance from the horizontal x-axis, and its distance from the vertical y-axis. The distance between any two points (x1, y1) and (x2, y2) can be calculated using the formulas = √[(x2 - x1) 2 + (y2 - y1) 2] Write a program that reads in the x and y coordinates of two points on a plane, and calculates the distance between them using the above formula.Ensure that your program uses functions from the cmath library to perform the calculations.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY