Python: Compute the Volume of a Cylinder

less than 1 minute read

The code has been modified slightly and now uploaded to the site.

The questions are from the C++ Textbook.

Question

<— Return Home

22.py

'''

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

'''
import math
radius = float(input("Enter the radius and length of a cylinder: "));
length = float(input());
area = radius * radius * math.pi;
volume = area * length;
print("The area is " + str(area));
print("The volume is " + str(volume));

<— Return Home