cylinder.py

Created by mobluse

Created on September 06, 2024

255 Bytes

Beräknar volym och densitet för en cylinder, givet massan, diametern och höjden.


from math import *
# Type your text here
m=float(input("massa (g)? "))
d=float(input("diameter (mm)? "))
h=float(input("höjd (mm)? "))
d=d/10
h=h/10
r=d/2
B=pi*r*r
V=B*h
print("Volym=",V,"cm**3")
rho=m/V
print("densitet=%.3F g/cm**3"%rho)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.