Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 3, Problem 2PE
Program Plan Intro

Price per inch of circular pizza

Program plan:

  • Define the main function.
    • Assign the value of “PI” to the variable.
    • Get the value of diameter and store it in a variable “diameter”.
    • Get the value of price and store it in a variable “price”.
    • Calculate radius value and store it in a variable “radius”.
    • Calculate area of the circle.
    • Calculate cost per inch of the circular pizza.
    • Display the result.

Blurred answer
Students have asked these similar questions
Write a program that will display a table of trigonometric functions: sin x, and tan x for x is from 0 to 20 degrees. The output should be: COS X, Angle in degrees sin x COS X tan x 1 1 0.0175 0.9998 0.0175 0.0349 0.9994 0.0349 20 0.3420 0.9397 0.3640 2.
Write a program that calculates the potential energy of 3 charges q1 = 1, q2 = 2, q3 = 3 located at points (1,2, 3), (3, –4, –5), and (-4, 2, –6) respectively. The units are coulombs for charge and meters for coordinates. The energy is given by the expression 9293 9193 9142 + T12 U = k r23 T13 where is the distance between the charges q; and q;, and k = 9 × 10º in SI units. Tij Your program should print the result on the screen.
A 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.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
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